Click to See Complete Forum and Search --> : Checkbox links


W8 4me
07-28-2005, 06:11 PM
How would I allow users to be taken to another page by clicking on a checkbox? I have five checkboxes.

obsesik
07-28-2005, 06:57 PM
I would try something like this...

<head>
<script type="text/javascript">
function go(){
window.location=("http://www.yourotherpage.com")
}
</script>
</head>

<body>
<form id="myForm"><input type="checkbox" value="myvalue" onChange="javascript:go();"></form>
</body>
</html>

Hope this helps!

obsesik
07-28-2005, 07:00 PM
sorry..you could also just put the code right inside the checkbox...

<input type="checkbox" value="myvalue" onChange="javascript:window.location=('http://www.yourotherpage.com');">

W8 4me
07-28-2005, 07:24 PM
Sorry none of them work for me. thanks anyway :)

obsesik
07-28-2005, 07:27 PM
what doesnt work? or maybe..why?

W8 4me
07-28-2005, 08:46 PM
Both scripts don't work for me. I don't know why, maybe it's because I'm using xhtml....

obsesik
07-29-2005, 04:16 AM
not really...could you post your code so I can try to help you?

W8 4me
07-29-2005, 06:45 AM
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
function go(){ window.location=("index_connection.html") }
</script>
</head>
<body>
<form name="myform">
<input type="checkbox" onChange="javascript:go();" />
</form>
</body>
</html>

It doesn't work with or without the <form> tags, or if I use inline script in the checkbox line.

bathurst_guy
07-29-2005, 07:25 AM
The code works for me. What browser are you using?

W8 4me
07-29-2005, 07:52 AM
Ie 6.

W8 4me
07-29-2005, 06:51 PM
Right, it works, but using the onChange event takes ages, sometimes 10-15 seconds for the page to load, whereas it happens straight away using onClick.