传值问题。 就你这网页而言你这样的意义何在? submit()多余了吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的submit()要传递其他的值,我没有写出来而已。我只是举个例子,等大家好明白一点! <html><script>function getParameters(){str = location.href.split("?")[1];if (str != null) {var parameters = str.split("&");for (var i=0;i<parameters.length;i++){paraName = parameters[i].split("=")[0];paraValue = parameters[i].split("=")[1];alert("参数"+paraName+"的值是:"+paraValue)}}}getParameters()</script><form name="form"><input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();"><input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();"></html> to vjlin(伟杰)(蓝色的)还是不明白你的意思 <html><form name="form"><input type="radio" name="rd" id="r1" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();"><input type="radio" name="rd" id="r2" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();"><script>function getParameters(){ str = location.href.split("?")[1]; if (str != null) { var parameters = str.split("&"); for (var i=0;i<parameters.length;i++) { paraName = parameters[i].split("=")[0]; paraValue = parameters[i].split("=")[1]; } }eval("document.form.r"+paraValue+".checked='true';")}getParameters()</script></html> <html><form name="form"><input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();"><input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();"></html>改为<html><form name="form"><input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';return function_name();"><input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';return function_name();"></html><script> function function_name(){ if() {……;} else{……;} }</script>试试 楼上的,你这招不行,早试过了~~其实楼主提供的这个范例不太好,因为执行过submit()以后,后面的this.checked='true'根本就执行不到,而是重新加载aa.htm,这时候如何去判断提交之前用户是点击哪个radio呢 ??除非用asp或者jsp来做,javascript好象困难....关注中! vjlin(伟杰)(蓝色的) 已经给出了正解,我收回刚才的话。谢谢 vjlin(伟杰)(蓝色的) ,厉害!可以结帖了~!!! 为了便于理解,其实也可以写为:<html><script>function getParameters(){str = location.href.split("?")[1];if (str != null) {var parameters = str.split("&");paraName = str.split("=")[0]; //修改处paraValue = str.split("=")[1];//修改处alert("参数"+paraName+"的值是:"+paraValue)}}getParameters()</script><form name="form"><input type="radio" name="rd" value=1 onclick="document.form.action='aa.html';this.checked='true';submit();"><input type="radio" name="rd" value=2 onclick="document.form.action='aa.html';this.checked='true';submit();"></html> js通过ip地址获取ip地址所在的经纬度 如何截取字符串;之前和之后的字符? 急求解决,高手进来帮看看啊 脚本中$表示什么意思? 表单提交前,JS如何取得动态生成的下拉框的值 ajax解决:“如何离开了输入框就在服务器端进行判断” 請問如何用回車鍵來替代TAB鍵的功能? 菜鸟提问:如何解决重复提交表单的问题。 请帮帮我!关于脚本调用ASP代码块中的变量? 请问关于IsDigit()的问题? 怎么得到listbox值的个数? 一个简单的问题,好拿分
我只是举个例子,等大家好明白一点!
<script>
function getParameters()
{
str = location.href.split("?")[1];
if (str != null)
{
var parameters = str.split("&");
for (var i=0;i<parameters.length;i++)
{
paraName = parameters[i].split("=")[0];
paraValue = parameters[i].split("=")[1];
alert("参数"+paraName+"的值是:"+paraValue)
}
}
}
getParameters()
</script>
<form name="form">
<input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
<input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
</html>
<form name="form">
<input type="radio" name="rd" id="r1" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
<input type="radio" name="rd" id="r2" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
<script>
function getParameters()
{
str = location.href.split("?")[1];
if (str != null)
{
var parameters = str.split("&");
for (var i=0;i<parameters.length;i++)
{
paraName = parameters[i].split("=")[0];
paraValue = parameters[i].split("=")[1];
}
}
eval("document.form.r"+paraValue+".checked='true';")
}
getParameters()
</script>
</html>
<form name="form">
<input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
<input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
</html>
改为
<html>
<form name="form">
<input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';return function_name();">
<input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';return function_name();">
</html><script>
function function_name(){
if() {……;}
else{……;}
}
</script>
试试
已经给出了正解,我收回刚才的话。
谢谢 vjlin(伟杰)(蓝色的) ,厉害!可以结帖了~!!!
<script>
function getParameters()
{
str = location.href.split("?")[1];
if (str != null)
{
var parameters = str.split("&");paraName = str.split("=")[0]; //修改处
paraValue = str.split("=")[1];//修改处
alert("参数"+paraName+"的值是:"+paraValue)}
}
getParameters()
</script>
<form name="form">
<input type="radio" name="rd" value=1 onclick="document.form.action='aa.html';this.checked='true';submit();">
<input type="radio" name="rd" value=2 onclick="document.form.action='aa.html';this.checked='true';submit();">
</html>