...

View Full Version : html button help needed?



Cheeseboy
05-08-2006, 08:29 PM
hi, i want to have a button that says next and will only work if the checked box on top of it is checked. Does anyone know how to do this?
THanks:thumbsup: :cool:

Beagle
05-08-2006, 08:33 PM
in the function that the next button calls, you can just check if the checkbox is checked:



<input type="button" onclick="func();" />

<script type="text/javascript">
function func()
{
if (document.form1.buttonCheckbox.checked)
{
doWhatever;
}
}
</script>

Cheeseboy
05-08-2006, 08:43 PM
doesnt really make sense is this the whole code? or do you want me to right things in it?

Cheeseboy
05-08-2006, 09:24 PM
Ok, an example of it would be like the agree form we use here to register.

Beagle
05-08-2006, 09:40 PM
well, what does the button do?

A button that says next doesn't actually do anything when you click it. You have to tell it what to do.

So yes, you need to fill things in.

Cheeseboy
05-08-2006, 09:58 PM
im am goign to list all my rules then, when you check in the box that you agree then you click a button called next which will take you to a different page. If you dont check the box and when you try to click next it i dont want it to work.

Beagle
05-08-2006, 10:02 PM
so where I have doWhatever, you put the code that the button is supposed to execute.

Cheeseboy
05-08-2006, 10:44 PM
could you give me an example of the button code?

Beagle
05-09-2006, 03:41 AM
document.signupform.submit; ??

I mean, I don't know what you want to do. Submit a form? Calculate the total cost of the order form? Send an ajax call to validate their data? Do you see my dilemma? I have NO idea what you want beyond "the button not working unless the checkbox is checked". I got that for you, now you gotta make it work when the checkbox IS checked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum