如何响应radio事件(在当前页)?

lfwvb 2000-07-25 10:40:00
<input type=radio name=s1 value="table1">1
<input type=radio name=s1 value="table2">2
<input type=radio name=s1 value="table3">3
...
当在当前页
选中1后,sqlstr=sqlstr & "table1"
选种2后,sqlstr=sqlstr & "table2"
....
在当前页用什么函数表示所选中radio的值?用JavaSCript?如何实现的?
要在当前页响应一个事件,选种radio的值如何记住?


...全文
701 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lfwvb 2000-07-26
  • 打赏
  • 举报
回复
哎,知我者,ghj1976也!
huntout 2000-07-26
  • 打赏
  • 举报
回复
sqlstr得到後,你要做一個查詢對吧?這必須在服務器端執行呀!
在當前頁處理,你可以把form的action設為當前頁your.asp
蝈蝈俊 2000-07-26
  • 打赏
  • 举报
回复
呵呵呵呵,笔误。

<form action="" method="post" name="testsql">
<input type="hidden" name="sqlstr" value="select * from table1"> 默认值
<input type=radio name=s1 value="table1" checked onclick="javascript:signin(1)">1
<input type=radio name=s1 value="table2" onclick="javascript:signin(2)">2
<input type=radio name=s1 value="table3" onclick="javascript:signin(3)">3
</form>

<script language="javascript">
<!--

function signin(stype){

switch(stype){
case 2 :
document.testsql.sqlstr.value= 'select * from table2';
break;
case 3 :
document.testsql.sqlstr.value= 'select * from table3';
break;
default :
document.testsql.sqlstr.value= 'select * from table1';
}
}
//-->
</script>
蝈蝈俊 2000-07-26
  • 打赏
  • 举报
回复
<form action="" method="post" name="testsql">
<input type="hidden" name="sqlstr" value="select * from table1"> 默认值
<input type=radio name=s1 value="table1" checked onclick="javascript:signin(1)">1
<input type=radio name=s1 value="table2" onclick="javascript:signin(2)">2
<input type=radio name=s1 value="table3" onclick="javascript:signin(3)">3
</form>

<script language="javascript">
<!--
var f_class1,f_class2
f_class1 = '转贴'
f_class2 = '文本'

function signin(stype){

switch(stype){
case 2 :
document.testsql.sqlstr.value= 'select * from table2';
break;
case 3 :
document.testsql.sqlstr.value= 'select * from table3';
break;
default :
document.testsql.sqlstr.value= 'select * from table1';
}
}
//-->
</script>
Tyro 2000-07-26
  • 打赏
  • 举报
回复
我说的就是在当前页的处理呀!
VictorYu 2000-07-26
  • 打赏
  • 举报
回复
如果你是准备拼一个SQL的字串, 那就是说用户选择完后会提交回服务器.所以字串可以直接用
sqlstr = szlstr & rad1.value
来写,
如何传回服务器就是另一回事了.
lfwvb 2000-07-25
  • 打赏
  • 举报
回复
在当前页如何处理呢?
Tyro 2000-07-25
  • 打赏
  • 举报
回复
给radio添加id<input type=radio id=rad1 name=s1 value="table1">1
通过rad1.value可以获得radio的值"table1"
通过rad1.checked可以判断radio是否被选中

28,390

社区成员

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

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