怎样把 <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>
<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属性就可以了~~ 唉,感觉我口水话来回说了,呵呵,希望我了解的能对楼主有用!你看看你想要的效果,是以上的那种。