一个javascript的问题

ech0yunyun 2004-01-17 10:27:28
问题是这样的 我的一张编辑页面
function actionclick()
{
var i,ok;
' i=document.form1.r1.checked.value;

'alert(i);
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
form1.action="'ConfirmAddPlan.asp?itme="& i &"'";
form1.submit();
}
} 用来提交


<p>
<input type="radio" value="V1" name="R1"
<%
if stritem="未设定" then
response.write "checked"
end if
%>
>不设定时间
<input type="radio" value="V1" name="R1"
<%
if stritem="预计时间" then
response.write "checked"
end if
%>
>设定预计时间
<input type="radio" value="V1" name="R1"
<%
if stritem="实际时间" then
response.write "checked"
end if
%>
>设定实际时间
</P> 页面初始的时候帮定内容


<input type='button' value='添加提交' name='提交3' onclick='actionclick()'> 修改后提交


问题是 我改变radio的check状态 然后想在提交的时候把radio checked的值传出去 为什么一点反映都没有啊 ??
...全文
33 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
msn 呢?呵呵 我是新手啊 真不好意思 麻烦你
谢谢 能用的
peng0731 2004-01-17
  • 打赏
  • 举报
回复
不要意思,弄错了
actionclick(<%=id%>,'<%=strType%>')">
我这里不能上qq的
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
你有qq吗
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
strid 是个数值型的 但是我这样写还是不行啊。
<input type='button' value='添加提交' name='提交3' onclick="actionclick("&‘strid &",'"& strtype &"')">
peng0731 2004-01-17
  • 打赏
  • 举报
回复
该为:form1.action="test1.asp?itme="+x+"&id="+id+"&type="+type;
<input type='button' value='添加提交' name='提交3' onclick="actionclick('"& strid &"','"& strtype &"')">
actionclick的参数里面''里面包含字符串,如果是数值型,就不要''


ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
你还在吗?我还有个问题 我把你的程序该了该
function actionclick(id,type)
{
var i,ok,x;
for (i = 0 ; i < form1.length ; i ++ )
{
if (form1.elements[i].type == "radio")
{
if (form1.elements[i].checked)
{
x=form1.elements[i].value
alert(x);
}
}
}
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
alert(x);
form1.action="test1.asp?itme="+x+"id="+id+"type="+type;
form1.submit();
}
}
</script>

<input type='button' value='添加提交' name='提交3' onclick='actionclick(strid,strtype)'>
strid,strtype是两个变量但是都已经有值了 这样为什么又不能提交了啊?
peng0731 2004-01-17
  • 打赏
  • 举报
回复
分无所谓的,解决了问题就好,大家相互帮助嘛
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
恩 谢谢 我看到了 我现在没有什么分 有分的话就给你了。
peng0731 2004-01-17
  • 打赏
  • 举报
回复
i=document.form1.r1.checked.value;是不对的,好像没这种写法
你的radio的value全部是v1,所以得到的值都是v1啊
看看例子:可以得到不同值
<input type="radio" value="V1" name="R1"
<%
if stritem="未设定" then
response.write "checked"
end if
%>
>不设定时间
<input type="radio" value="V2" name="R1"
<%
if stritem="预计时间" then
response.write "checked"
end if
%>
>设定预计时间
<input type="radio" value="V3" name="R1"
<%
if stritem="实际时间" then
response.write "checked"
end if
%>
>设定实际时间

ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
我按照你那个方法
function actionclick()
{
var i,ok,x;
for (i = 0 ; i < form1.length ; i ++ )
{
if (form1.elements[i].type == "radio")
{
if (form1.elements[i].checked)
{
x=form1.elements[i].value
alert(x);
}
}
}
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
alert(x);
form1.action="test1.asp?itme="+x;
form1.submit();
}
}
</script>


不管我的radio怎么改变 alert(x)的值都是v1
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
peng0731(小毛头)
我想问你i=document.form1.r1.checked.value;
不对吗?
peng0731 2004-01-17
  • 打赏
  • 举报
回复
function actionclick()
{
var i,ok,x;
for (i = 0 ; i < form1.length ; i ++ )
{
if (form1.elements[i].type == "radio")
{
if (form1.elements[i].checked)
{
x=form1.elements[i].value
alert(x);
}
}
}
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
alert(x);
form1.action="test1.asp?itme="+x;
form1.submit();
}
}
</script>
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
我就是把程序该成这样也不能提交
function actionclick()
{
form1.action="'ConfirmAddPlan.asp?itme="& i &"'";
form1.submit();

} 用来提交
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
还是不行啊 我按提交按钮什么反应都没有的
peng0731 2004-01-17
  • 打赏
  • 举报
回复
function actionclick()
{
var i,ok;
for (i = 0 ; i < form1.length ; i ++ )
{
if (form1.elements[i].type == "radio")
{
if (form1.elements[i].checked)
{
i=form1.elements[i].value
alert(i);
}
}
}
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
form1.action="'ConfirmAddPlan.asp?itme="& i &"'";
form1.submit();
}
}
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
是不是我的javascript什么地方写的不对啊?
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
什么意思啊 其他的javascript是能用的啊
robincsdn 2004-01-17
  • 打赏
  • 举报
回复
Are you kidding me????????

据我之愚见, 此例恐怕难逃 vbscript 之嫌吧。
ech0yunyun 2004-01-17
  • 打赏
  • 举报
回复
高手帮帮忙啊 我是新手

整个页面程序基本是这样的


<% option explicit
Response.Buffer = True
Response.ExpiresAbsolute = Now - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#include file="../conn.asp"-->
<!--#include file="../checklogin.asp"-->
<html>
<script LANGUAGE="javascript">

function actionclick()
{
var i,ok;
i=document.form1.r1.checked.value;

'alert(i);
ok= window.confirm("确定要修改当前的设定吗?" );
if (ok)
{
form1.action="ConfirmAddPlan.asp";
form1.submit();

}

}

</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>进度项目设定</title>
<link rel="stylesheet" href="../common.css">
</head>

<body bgcolor="#E4F2FC">
<%
if session("pactlevel")<=0 then
response.write "你无权限"
response.end
end if
dim strid,strfields,stritem,strtype
strid=request("id")
strfields=request("fields")
stritem=request("item")
strtype=request("type")
%>
<form method="POST" name="form1">
<table border="0" width="533" cellspacing="0" cellpadding="0" height="266">
<p>
<b><font face="黑体" size="5" color="#000080">
<%
response.write "设定"& strtype &"的时间"
%></font></b> </p>

<p>
<input type="radio" value="V1" name="R1"
<%
if stritem="未设定" then
response.write "checked"
end if
%>
>不设定时间
<input type="radio" value="V1" name="R1"
<%
if stritem="预计时间" then
response.write "checked"
end if
%>
>设定预计时间
<input type="radio" value="V1" name="R1"
<%
if stritem="实际时间" then
response.write "checked"
end if
%>
>设定实际时间
</P>

<P>
<font face="黑体" size="3" color="#000080">
<%
if stritem="未设定" then
response.write strtype & "目前没有设定时间"
end if
if stritem="预计时间" then
response.write "目前设定的是" & strtype & "的计划时间,计划时间为"& strfields &"。"
end if
if stritem="实际时间" then
response.write "目前设定的是" & strtype & "的实际时间,实际时间为"& strfields &"。"
end if
%>
</font>
</p>

<p>时间:
<input type="text" name="time1" size="50" <%
if stritem="未设定" then
response.write "disabled=true"

else
'response.write "disabled=false"
response.write "VALUE='"
response.write strfields & "'"

end if
%>>
</P>
<p>
<input type='button' value='添加提交' name='提交3' onclick='actionclick()'>
<input type="reset" value="全部重写" name="全部重写">
<input type="button" value="返回" name="button" onclick="window.history.back()">
</P>
</table>
</form>
</body>
peng0731 2004-01-17
  • 打赏
  • 举报
回复
我这里上班时间不能聊天的,而且我也不喜欢聊天,不要意思,有什么问题可以来这里文大家的

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧