Wuu Posted July 7, 2009 Report Share Posted July 7, 2009 Šādi strādā. function sendvote() { if(document.voteform.vote[0].checked == 'true') { send('040 1'); } if(document.voteform.vote[1].checked == 'true') { send('040 2'); } } Bet šādi nē! function sendvote() { if(document.voteform.vote[0].checked == 'true') { send('040 1'); } else { send('040 2'); } } Noņēmos zils no dusmām! Quote Link to comment Share on other sites More sharing options...
0 marcis Posted July 7, 2009 Report Share Posted July 7, 2009 Atšķirība starp boolean un string ir zināma? Citādi izskatās, ka ir ok. Kas tieši tur nestrādā tā kā vajag? Quote Link to comment Share on other sites More sharing options...
0 Wuu Posted July 7, 2009 Author Report Share Posted July 7, 2009 Zinu ,zinu dažādi testēju ,bet paļubomu mana līkrocība Šādi aizgāja! function sendvote() { if(document.getElementById('vote1').checked) {send('0401'); } else { send('0402'); } } Quote Link to comment Share on other sites More sharing options...
0 Web Developer Posted July 8, 2009 Report Share Posted July 8, 2009 checked PropertyThis property is a boolean value that sets or returns the current state of the Checkbox object; true if checked and false otherwise. Attiecīgi izteiksme: document.voteform.vote[0].checked == 'true' pārbauda vai īpašība "checked" kā tips String ir vienāda ar virkni "true", kas protams nav pareizi, jo "checked" atgriež Boolean. Vajdzētu darboties jebkuram no šiem variantiem: if (document.voteform.vote[0].checked == true) {} if (document.voteform.vote[0].checked) {} Quote Link to comment Share on other sites More sharing options...
Question
Wuu
Šādi strādā.
Bet šādi nē!
Noņēmos zils no dusmām!
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.