怎样把 <input type=submit value="Done!">这段加上超链接?怎样实现当点击接受按钮然后点击完成就能进入设定的超链接?点击不接受按钮将无法进入设定的超链接?希望有哥哥姐姐们帮助小妹妹。譬如:超链接为www.baidu.com ,附源代码:
<SCRIPT LANGUAGE="JavaScript">
<! >
<! >
<!-- Begin
agree = 0; // 0 means 'no', 1 means 'yes'
// End -->
</script>
</HEAD>
<!-- -->
<BODY>
<center>
<form name=enableform>
You can agree to the terms. (just a demo)<br>
<br>
<input type=radio name='enable' value='agree' onClick="agree=1; document.enableform.box.focus();">I agree | <input type=radio name='enable' value='disagree' onClick="agree=0; document.enableform.box.value='';">I disagree<br>
<br>
<br>
<input type=submit value="Done!">
</form>
</center>
<SCRIPT LANGUAGE="JavaScript">
<! >
<! >
<!-- Begin
agree = 0; // 0 means 'no', 1 means 'yes'
// End -->
</script>
</HEAD>
<!-- -->
<BODY>
<center>
<form name=enableform>
You can agree to the terms. (just a demo)<br>
<br>
<input type=radio name='enable' value='agree' onClick="agree=1; document.enableform.box.focus();">I agree | <input type=radio name='enable' value='disagree' onClick="agree=0; document.enableform.box.value='';">I disagree<br>
<br>
<br>
<input type=submit value="Done!">
</form>
</center>
解决方案 »
- Microsoft JScript 运行时错误: 'null' 为空或不是对象
- 如何强制js代码写在一行中
- 点击文本框时,鼠标不能转为输入状态,只有在文本框最左边时候,才能输入字符,真是怪了
- 两个问题:1、如何用脚本实现样式表xxx:hover{};2、如何屏蔽IE8的“加速器”(activity)
- 点击链接在其链接下方显示一个层和在这个层里静态分页
- 关于JS脚本的限制问题
- javascript不能运行---online waiting
- jsp的button onclick事件 如何传带html标签的参数给js
- 关于JQUERY
- FAQ问题(一个下拉框和文本框的问题)后续
- 关于菜单的
- 求一个Jquery的右键2级菜单
<input type=submit value="Done!" onclick=jumpto()>
function jumpto(){
location.herf="http://www.baidu.com"
}
agree = 0;
function ag(){
switch(agree){
case 0:
return false;
case 1:
window.open("http://www.baidu.com");
break;
}
}
</script>
</HEAD>
<!-- -->
<BODY>
<center>
<form name=enableform action="test10.asp">
You can agree to the terms. (just a demo)<br>
<br>
<input type=radio name='enable' value='agree' onClick="agree=1;document.enableform.box.focus();">I agree |
<input type=radio name='enable' value='disagree' onClick="agree=0;document.enableform.box.value=''">I disagree<br>
<br>
<br>
<input type=submit value="Done!" onclick="return ag()">
</form>ps:我没太懂你的意思,
如果你想获取到表单的提交值,同时还要到打开其他网站如:百度,就用"window.open";
如果你的意思只是假设agree=1就提交,agree=0就不提交的话,那就很简单,把ag()函数的代码改成:
[code=JScript]
function ag(){
if(agree=0){
return false
}}code]其他我也想不出如果了,因为你的提交按钮(Done!)的type设置成了submit,用window.location.href的语句跳转到百度页面的话,我试了下,实现不了,因为type=submit时提交到的是你的表单form 的action属性设定的地址。所以我就用了window.open方法,如果仅仅是提交到接收表单值的页面,那只要设定form的action属性就可以了~~ 唉,感觉我口水话来回说了,呵呵,希望我了解的能对楼主有用!你看看你想要的效果,是以上的那种。