Jump to content

checkbox and dropdown to redirect to a page


irkevin

Recommended Posts

well.. have a look at this code

 

<script type="text/javascript">
function validate(){
  if (document.test.chk.checked == true)
  {
if(document.test.sl.selectedIndex == 0)
{
	location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
}
else if(document.test.sl.selectedIndex == 1)
{
	location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
}
  }
}
</script>
</head>
<body>
<form name="test">
<input type="checkbox" name="chk" value="1">1
<input type="checkbox" name="chk" value="2">2
<select name="sl" onblur="return validate();">
<option>google</option>
<option>waaa</option>
</select>
</form>

 

 

For now it doesn't work because i have two checkboxes..

 

but this one works, when only with one checkbox

 

<script type="text/javascript">
function validate(){
  if (document.test.chk.checked == true)
  {
if(document.test.sl.selectedIndex == 0)
{
	location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
}
  }
}
</script>
</head>
<body>
<form name="test">
<input type="checkbox" name="chk" value="1">1
<select name="sl" onblur="return validate();">
<option>google</option>
<option>waaa</option>
</select>
</form>

 

I will need this to work even if i have multiple checkbox.. any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.