gaijin
-
Posts
5 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by gaijin
-
-
Hadien, well I was probably a bit understating it when I said I wasn't very good at this... your first example looks just right for me, but could you tell me what to put after the opening script tag? I haven't been able to get it to work so far.
-
Thanks, much appreciated. As I'm not too good at javascript it'll take me a while, and some tinkering, to absorb your information!
Update:
Thanks Ingolme and Hadien for your replies. It seems there's no easy way, but your code, Hadien, is certainly shorter than the one I had been working with, and where you commented in "//previously defined conditions have higher priority over later conditions." it looks like that could be useful for me.
-
Sorry, what does that mean? Is that a 'no' to my question?
-
I'm hoping somebody will be able to set me on the right path to making my code simpler, and I hope my description will suffice.Here is my query:When I use many checkboxes on a page, I'd like to know if there is a way to make the array so that I only need to specify the 'true' values, and have a blanket for all other boxes to be 'false'.In this following example it is easy to get the desired result to get 'message 1' when boxes 1 and 4 are checked, but 2 and 3 remain unchecked; and also 'message 2' then boxes 1, 2 and 4 are checked but box 3 remains unchecked, and then 'message 3' for all other combinations:{if(cb[1].checked==true&&cb[2].checked==false&&cb[3].checked==false&&cb[4].checked==true) { alert('message' 1); }else if(cb[1].checked==true&&cb[2].checked==true&&cb[3].checked==false&&cb[4].checked==true) {alert('message' 2); }else { alert('message 3'); }}But if I have 12 boxes, with a very large total of possible combinations, it would be impractical to use that string, as I need to specify the majority of combinations.And if I simply use:{if(cb[1].checked==true&&cb[4].checked==true) { alert('message' 1); }else { alert('message 3'); }}then the user gets 'message 1' even if he checks, say, box 5 along with boxes 1 and 4.So, I'd like to know if there is a way to require 'all other boxes' to be unchecked.Thanks in advance for any ideas.
All other checkboxes==false possible?
in JavaScript
Posted
Yes, I'd already spotted that, but I don't have quotes in the actual test page.
Chrome says 'Uncaught ReferenceError: cb is not defined'
What do I put in the form onsubmit= ?
On the page I've already been using I have onsubmit="doRedirect(this);return false;"> but I don't know how to adapt it to your code.
sorry to ask such basic questions.