localhero Posted February 23, 2008 Report Share Posted February 23, 2008 Ir funkcija: function some_func(id) { if(document.getElementById.(id).checked == false) { do some code; } } <input onclick="some_func('some_id')" /> Vajag ar getElementById dabut to id kas tiek nodots ar onclick palidzibu. cerams ka izskaidroju kaut cik skaidri :) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 23, 2008 Report Share Posted February 23, 2008 (edited) cerams ka izskaidroju kaut cik skaidri :) Nee galigi skjibi ... :( Tev tachu ir tas ID !!! Prieks kam tad ta noskaidrosanai izmantot getElementById.(id) ??? <script> function bla(id) { alert(id) } </script> <a href="#" Onclick="bla('mans_id')">....</a> Edited February 23, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
andrisp Posted February 23, 2008 Report Share Posted February 23, 2008 Es kaut kaa neiebraucu, localhero, vai tad tev tas kods jau nedara to, ko pats prasi ? Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 function some_func(id) { if(document.getElementById.(id).checked == false) { do some code; } } <input onclick="some_func('some_id')" /> <input onclick="some_func('some_other_id')" /> <input onclick="some_func('some_random_id')" /> <input onclick="some_func('some_another_id')" /> <input onclick="some_func('some_id2')" /> Man vajag lai getElementById pagrabtu attiecigo id. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 23, 2008 Report Share Posted February 23, 2008 if(document.getElementById.(id).checked == false) {<input onclick="some_func('some_id2')" /> Man vajag lai getElementById pagrabtu attiecigo id. Nu bet vinsh taks to dariis... Kljuda ir ieksx: getElementById.(id).checked == false nestradas ar <input onclick="some_func... INPUT janorada tips --> ka tas ir Kjeksh boksis savadak tam // getElementById.(id).checked // zud jega ... Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 Nu es domaju lai dinamiski varetu padot to id kaadu vajag. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 23, 2008 Report Share Posted February 23, 2008 ... NEsi pamodies?? paskaties ko dara kods seit Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 Man bija slinkums rakstit visu kodu bet man ir noradots tips un vis ir bumbas ja es ierakstu ar roku iekš funkcijas id(getElementById('id')). Es domaju vai vispar tas ir iespejams. Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 tev ir alert bet man vajag getElementByID Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 23, 2008 Report Share Posted February 23, 2008 a tam input elementam vispar ir ID="id_kursh_janodod" ???? Jebshu par to piemirsi??? Link to comment Share on other sites More sharing options...
andrisp Posted February 23, 2008 Report Share Posted February 23, 2008 localhero, kur ir probleema ? Tavam piemeeram ir jaastraadaa. Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 Es zinu ka butu jastrada bet nestrada. Link to comment Share on other sites More sharing options...
localhero Posted February 23, 2008 Author Report Share Posted February 23, 2008 Rekur es iznemu funkciju kadu es izmantoju: <script type="text/javascript"> function pd32(numurs,div_id) { var pirmais_id = div_id + "1"; var otrais_id = div_id + "2"; alert(pirmais_id); if(document.getElementById.(pirmais_id).checked == false) { document.getElementById(otrais_id).innerHTML = ""; } else { document.getElementById(otrais_id).innerHTML = "<select name=\"" + otrais_id + "skaitlis\"" + numurs + darbs32; } } </script> <html><body> <label for="o_skruve1">OK skruve</label> <input type="checkbox" class="checkbox" id="o_skr" onclick="pd32(1,document.getElementById('o_skr').value)" value="o_skruve"> <div id="o_skruve1"></div> </body></html> Link to comment Share on other sites More sharing options...
andrisp Posted February 23, 2008 Report Share Posted February 23, 2008 Kaapeec tev aiz pirmaa getElementById ir punkts ? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 23, 2008 Report Share Posted February 23, 2008 un kas tas ir ?? rekursija ?? --> tur tachu vinjam padot true/false nevis ID.. // checkbox" id="o_skr" onclick="pd32(1,document.getElementById('o_skr').value)" // checkbox" id="o_skr" onclick="pd32(1,'o_skr')" ... jo tu jau pec tam noskaidro vai vinsh iekjeksets vai nav .... Link to comment Share on other sites More sharing options...
Recommended Posts