Home  >  Article  >  Web Front-end  >  How to redirect click on a radio button link to the corresponding URL using javascript_javascript skills

How to redirect click on a radio button link to the corresponding URL using javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:45:341340browse

The example in this article describes the method of using JavaScript to redirect clicks on radio button links to the corresponding URL. Share it with everyone for your reference. The details are as follows:

A button special effect is implemented here. When the check box button is clicked, the link is activated and jumps to a certain URL. Here are mainly some functions derived from onClick. Then with the function, you can write more button special effects. Come.

The screenshot of the running effect is as follows:

The specific code is as follows:

<html>
<head>
<title>点击文本框激活链接转向某网址</title>
<SCRIPT>
function go(loc) {
window.location.href = loc;
}
</script>
</head>
<body>
<form name="form">
 <div align="center">
  <input type="radio" name="loc" onClick="go('http://www.baidu.com');">
  百度搜索<br>
  <input type="radio" name="loc" onClick="go('http://www.jb51.net');">
  脚本之家<br>
  <input type="radio" name="loc" onClick="go('http://www.qq.com');">
  腾讯QQ<br>
 </div>
</form>
</body>
</html>

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn