Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - [VB.NET] Modificare Html-Textbox
Forum - C# / VB.NET - [VB.NET] Modificare Html-Textbox

Pagine: [ 1 2 ] Precedente | Prossimo
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 21:57
Martedì, 27/04/2010
Ragazzi ho visto molte guide in questi giorni di come ottenere un Id di un bottone e come accedere, ma vorrei capire come modificare il vaolore di una textbox in una pagina web, esempio :
Codice sorgente - presumibilmente C# / VB.NET

  1. <form method="POST" name="snd" action="build.php">
  2.                         <input type="hidden" name="id" value="25" />
  3.                         <input type="hidden" name="z" value="420e0d" />
  4.                         <input type="hidden" name="a" value="2" />
  5.                         <table cellpadding="1" cellspacing="1" class="build_details">
  6.                                 <thead>
  7.                                         <tr>
  8.                                                 <td>Nome</td>
  9.                                                 <td>Numero</td>
  10.                                                 <td>max</td>
  11.                                         </tr>
  12.                                 </thead>
  13.                                 <tbody>
  14.                                        
  15.                                 <tr>
  16.                                         <td class="desc">
  17.                                                 <div class="tit">
  18.                                                         <img class="unit u11" src="img/x.gif" alt="Combattente" title="Combattente" />
  19.                                                         <a href="#" onClick="return Popup(11,1);">Combattente</a> <span class="info">(Presenti: 0)</span>
  20.                                                 </div>
  21.                                                 <div class="details">
  22.                                                         <img class="r1" src="img/x.gif" alt="Legno" title="Legno" />95|<img class="r2" src="img/x.gif" alt="Argilla" title="Argilla" />75|<img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />40|<img class="r4" src="img/x.gif" alt="Grano" title="Grano" />40|<img class="r5" src="img/x.gif" alt="Consumo di grano" title="Consumo di grano" />1|<img class="clock" src="img/x.gif" alt="durata" title="durata" />0:09:43
  23.                                                 </div>
  24.                                         </td>
  25.                                         <td class="val">
  26.                                                 <input type="text" class="text" name="t1" value="1" maxlength="4">
  27.                                         </td>
  28.                                         <td class="max">
  29.                                                 <a href="#" onClick="document.snd.t1.value=14; return false;">(14)</a>
  30.                                         </td>
  31.                                 </tr>
  32.                        
  33.                                 <tr>
  34.                                         <td class="desc">
  35.                                                 <div class="tit">
  36.                                                         <img class="unit u12" src="img/x.gif" alt="Lanciere" title="Lanciere" />
  37.                                                         <a href="#" onClick="return Popup(12,1);">Lanciere</a> <span class="info">(Presenti: 0)</span>
  38.                                                 </div>
  39.                                                 <div class="details">
  40.                                                         <img class="r1" src="img/x.gif" alt="Legno" title="Legno" />145|<img class="r2" src="img/x.gif" alt="Argilla" title="Argilla" />70|<img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />85|<img class="r4" src="img/x.gif" alt="Grano" title="Grano" />40|<img class="r5" src="img/x.gif" alt="Consumo di grano" title="Consumo di grano" />1|<img class="clock" src="img/x.gif" alt="durata" title="durata" />0:15:07
  41.                                                 </div>
  42.                                         </td>
  43.                                         <td class="val">
  44.                                                 <input type="text" class="text" name="t2" value="0" maxlength="4">
  45.                                         </td>
  46.                                         <td class="max">
  47.                                                 <a href="#" onClick="document.snd.t2.value=9; return false;">(9)</a>
  48.                                         </td>
  49.                                 </tr>





dovrei cambiare il "value" del calss"val" e mettergli un valore diverso, però non so con quale code ottenere questo elemento.... e come modificarlo, ho provato a modificare manualmente l'html e a caricare la pagina secondo il nuovo html ma non và c'è bisogno di una classe come quella usata nel "login automatico" per modificare il text... sapete darmi una mano?

Ultima modifica effettuata da salva94 il 27/04/2010 alle 23:24
PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 11:36
Mercoledì, 28/04/2010

PM Quote
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 15:56
Mercoledì, 28/04/2010
sisi prima di scrivere questo post ho visto quel link... ma non capisco come focalizzare solamente
Codice sorgente - presumibilmente Plain Text

  1. <td class="val">
  2.                         <input type="text" class="text" name="t1" value="1" maxlength="4">
  3.                     </td>


PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 12:02
Venerdì, 30/04/2010
Hai provato Document.All("t2") ?

PM Quote
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 14:51
Venerdì, 30/04/2010
scusami e come faccio a ottenerlo? Cioè io faccio
Codice sorgente - presumibilmente Plain Text

  1. WebBrowser1.Document.All("t2").Focus()


e poi?

PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 14:31
Sabato, 01/05/2010
.SetAttribute("class", "val2")

Comunque c'è scritto nel link che ti ho già dato, leggi meglio.

PM Quote
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 13:49
Venerdì, 07/05/2010
scusate se scrivo molto in ritardo, in questi giorni sono stato impegnato .
Volevo dire che questo Setattribute dove lo devo inserire? Devo fare un create element? Devo creare un Dizionario?

PM Quote
Avatar
Federico_VbNet_Programmer (Normal User)
Expert


Messaggi: 222
Iscritto: 03/04/2010

Segnala al moderatore
Postato alle 21:21
Venerdì, 21/05/2010
Per fare il focus in un oggetto nel webbrowser fai:
WebBrowser1.Document.All(nome oggetto).Focus()
e per cambiare il testo fai:
WebBrowser1.Document.All(nome oggetto).innertext = testo che vuoi
Dimmi come va a finire :D

PM Quote
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 16:37
Sabato, 22/05/2010
Ti ringrazio per l'innertext dato che era una propietà che non conoscevo il problema è che non riesco a focalizzare l'oggetto
Codice sorgente - presumibilmente Plain Text

  1. <td class="val">
  2.                         <input type="text" class="text" name="t1" value="1" maxlength="4">
  3.                     </td>



PM Quote
Pagine: [ 1 2 ] Precedente | Prossimo