<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.com_div{ width:100%float:left}
.com_content{ width:1000pxmargin:0px auto}
.com1{ width:100%float:leftmargin-bottom:10px}
.fleft{ float:leftmargin-right:50px}
.fleft1{ float:leftdisplay:none}
.fleft1 input{ border:1px solid #dddddd}
</style>
<script src="../map_dialog/js/jquery.js" type="text/javascript"></script>
<script>
$(function () {
$(".com1 input:radio").click(function () {
var o = $(this).attr("checked") == "checked" ? true : false
if (o) {
$(".fleft1").show()
}
})
})
</script>
</head>
<body>
<form id="form1" runat="server" action="test.aspx?action=save">
<div class="com_div">
<div class="com_content">
<div class="com1">1、1+1=?</div>
<div class="com1"><span class="fleft">A、1 <input type="radio" id="txta" name="txtanswer" value="1" /></span>
<span class="fleft">B、2 <input type="radio" id="txtb" name="txtanswer" value="2" /></span>
<span class="fleft">C、3 <input type="radio" id="txtc" name="txtanswer" value="3" /></span>
<span class="fleft">D、4 <input type="radio" id="txtd" name="txtanswer" value="4" /></span>
<span class="fleft1"><input type="text" id="other_txt" name="other_txt" /></span>
</div>
<div class="com1"><input type="submit" value=" 提 交" /></div>
</div>
</div>
</form>
</body>
</html>
//-------------------------------------------------------------------------
//后台代码
//-------------------------------
using System
using System.Collections.Generic
using System.Linq
using System.Web
using System.Web.UI
using System.Web.UI.WebControls
namespace WebTest.baidu_test
{
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Request["action"]!=null)
{
GetData()
}
}
/// <summary>
/// 得到数据
/// </summary>
public void GetData()
{
//得到前台选择的答案
string txt_answer = Request["txtanswer"].ToString()
}
}
}
//-你看这种可以不,如果不行可以跟我留言,希望能帮上你。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>在线调查</title>
<script language="javascript">
function GetSelectedEffect(effects)
{
var i
for(i=0i<effects.lengthi++)
{
if(effects[i].checked) return effects[i].value
}
return"[没有选择]"
}
function GetSelectedPrograms(programs)
{
var i,result=""
for(i=0i<programs.lengthi++)
{
if(programs[i].checked) result+="["+programs[i].value+"]"
}
return result
}
function ShowResult()
{
var f,msg
f=document.myform
msg="您感觉本站:"+GetSelectedEffect(f.page_effect)
msg+="\n您希望本站出现以下栏目:"+GetSelectedPrograms(f.program)
alert(msg)
}
</script>
</head>
<body>
<table width="400">
<tr>
<td align="center">
<h2>在线调查</h2>
<p>您感觉本站的主页效果如何(单选):</p>
<form name="myform">
<p><input type="radio" value="非常好" name="page_effect" checked>非常好
<input type="radio" value="好" name="page_effect">好
<input type="radio" value="一般" name="page_effect" >一般
</p>
<p>您希望本站出现以下什么栏目(多选):</p>
<p><input type="checkbox" name="program" value="新闻">新闻
<input type="checkbox" name="program" value="娱乐">娱乐
<input type="checkbox" name="program" value="教育">教育
</p>
<p><input type="button" name="bl" value="提交" onClick="ShowResult()"></p>
</form>
</td></tr>
</table>
</body>
</html>