Jump to content
php.lv forumi

izsaukt funkciju ar mainigo


localhero

Recommended Posts

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

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 by Grey_Wolf
Link to comment
Share on other sites

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

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

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

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

×
×
  • Create New...