Roy766 Posted May 7, 2008 Share Posted May 7, 2008 If I'm anewbie to PHP I'm a newbie to Javascript :-\ <html> <head> <title>PixelLife</title> <SCRIPT LANGUAGE="JavaScript"> x = 1; function win(); { x++; } </script> </head> <body> <SCRIPT LANGUAGE="JavaScript"> if x = 1; { alert ("You win!"); } <form> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox" onCheck="win()"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> </script> </body> </html> Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/ Share on other sites More sharing options...
rhodesa Posted May 7, 2008 Share Posted May 7, 2008 you have a few problems...but what are you trying to accomplish? when the correct checkbox is selected, do the alert? <html> <head> <title>PixelLife</title> <script type="text/javascript"> function win ( ele ) { if(ele.checked) alert("You win!"); } </script> </head> <body> <form> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox" onclick="win(this)"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"> <input type="checkbox"><br> </script> </body> </html> Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535471 Share on other sites More sharing options...
Roy766 Posted May 7, 2008 Author Share Posted May 7, 2008 Yeah, thanks. But how would I do this with variables? Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535475 Share on other sites More sharing options...
rhodesa Posted May 7, 2008 Share Posted May 7, 2008 do what with variables...please elaborate Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535521 Share on other sites More sharing options...
xenophobia Posted May 8, 2008 Share Posted May 8, 2008 Just put: <input type="checkbox" onclick=alert('You win!');"> I think you are confused with the javascript. Try ask Mr.Google for some javascript tutorial if you are interested. Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535754 Share on other sites More sharing options...
Roy766 Posted May 8, 2008 Author Share Posted May 8, 2008 I mean, make it so that when you click on the checkbox, it adds to a variable. It seems silly, but their is a reason. Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535954 Share on other sites More sharing options...
rhodesa Posted May 8, 2008 Share Posted May 8, 2008 'adds', but adds what? increments a variable? stores the value of it? your question is still vague... Link to comment https://forums.phpfreaks.com/topic/104620-what-am-i-doing-wrong-now/#findComment-535960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.