Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
linking two or more pages from radio button using javascript
12-13-2011, 04:17 AM
Post: #1
Lightbulb linking two or more pages from radio button using javascript
Now you are going to know how to get the value from radio button and open a new page when option is clicked.For example you have a form with two option boxes.

Quote:<form name="redirect">
<input type="radio" name="choose" onchange="return call()">yahoo</input> <input type="radio" name="choose" onchange="return call()">google</input>
</form>

Now write the script in head section as follows

<script type="text/javascript">
function call()
{
for(var i=0;i<document.redirect.length;i++)
{
if(document.redirect.choose[i].checked)
{
role=document.redirect.choose[i].value;
}
}
if(role=="yahoo") { window.open('http://www.yahoo.com','_self');
}
else
{
window.open('http://www.google.com','_self');
}
return true;
}
</script>


Try it and ask questions if any doubt and do comment us.

Happy coding
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Thumbs Up how to check value is number or not using Javascript rajasri 0 149 12-13-2011 04:31 AM
Last Post: rajasri
Question Print a particular area of a page using javascript rajasri 0 306 12-13-2011 04:20 AM
Last Post: rajasri

Forum Jump:


User(s) browsing this thread: 1 Guest(s)


WE will share important jobs and updates on facebook so like us to get updates