附上样式,再次感谢!<style type="text/css">
<!--
html,body{margin:0;padding:0;width:100%;height:100%;font-family:Verdana;}
body {text-align:center;background:#333366;}
ul,li{margin:0;padding:0;width:500px;list-style:none;font-size:14px;line-height:20px;color:#333366;font-weight:bold;height:20px;}
ul{padding:4px 0 0 50px;height:20px;}
h1{font-size:16px;color:#6699CC;width:150px;margin:4px 0 2px 0;padding: 2px 0 0 18px;}
a {text-decoration:none;color:#333366;font-size:14px;}
a:hover{text-decoration:underline;color:#333366;}
b{font-size:14px;font-weight:bold;}
.clear{clear:both;}
.page {width:100%;height:100%;margin:0;text-align:center;padding:40px 0 0 0;}
.top_content, .mid_content, .bottom_content{margin:0 auto;width:550px;}
.top_content{background:url(../img/top.gif) no-repeat;height:18px;}
.mid_content{height:690px;_height:660px;text-align:left;background:#FFF;}
.bottom_content{background:#333366 url(../img/bottom.gif) no-repeat top;height:58px;}
.notice{height:10px;text-align:center;width:auto;}
.alerm{color:#FF0000;font-size:14px;padding-top:2px;padding-left:100px;font-weight:bold;}
.mode {color:#FF0000;font-size:14px;}
.must{font-size:12px;color:#333366;height:10px;background:url(../img/star.gif) no-repeat;
background-position: 0 2px;_background-position:0 0;
padding-left:14px;margin-left:80px;}
.list1,.list2{width:auto;height:auto;border-bottom:1px dashed #9999B2;margin:4px 12px 4px 12px;padding-bottom:10px;}
.huge{width:362px;}
.pic{width:13px;height:13px;padding-top:2px;}
.choice{font-size:12px;padding-top:0px;_padding-top:4px;}
.wizard1{width:280px;}
.inp{padding-top:0px;_padding-top:4px;}
-->
</style>
<!--
html,body{margin:0;padding:0;width:100%;height:100%;font-family:Verdana;}
body {text-align:center;background:#333366;}
ul,li{margin:0;padding:0;width:500px;list-style:none;font-size:14px;line-height:20px;color:#333366;font-weight:bold;height:20px;}
ul{padding:4px 0 0 50px;height:20px;}
h1{font-size:16px;color:#6699CC;width:150px;margin:4px 0 2px 0;padding: 2px 0 0 18px;}
a {text-decoration:none;color:#333366;font-size:14px;}
a:hover{text-decoration:underline;color:#333366;}
b{font-size:14px;font-weight:bold;}
.clear{clear:both;}
.page {width:100%;height:100%;margin:0;text-align:center;padding:40px 0 0 0;}
.top_content, .mid_content, .bottom_content{margin:0 auto;width:550px;}
.top_content{background:url(../img/top.gif) no-repeat;height:18px;}
.mid_content{height:690px;_height:660px;text-align:left;background:#FFF;}
.bottom_content{background:#333366 url(../img/bottom.gif) no-repeat top;height:58px;}
.notice{height:10px;text-align:center;width:auto;}
.alerm{color:#FF0000;font-size:14px;padding-top:2px;padding-left:100px;font-weight:bold;}
.mode {color:#FF0000;font-size:14px;}
.must{font-size:12px;color:#333366;height:10px;background:url(../img/star.gif) no-repeat;
background-position: 0 2px;_background-position:0 0;
padding-left:14px;margin-left:80px;}
.list1,.list2{width:auto;height:auto;border-bottom:1px dashed #9999B2;margin:4px 12px 4px 12px;padding-bottom:10px;}
.huge{width:362px;}
.pic{width:13px;height:13px;padding-top:2px;}
.choice{font-size:12px;padding-top:0px;_padding-top:4px;}
.wizard1{width:280px;}
.inp{padding-top:0px;_padding-top:4px;}
-->
</style>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> JS调控问题 </TITLE>
<script type=text/javascript>
function $(o)
{
return document.getElementById(o);
}
function addAnswer()
{
var newanser=$("newanswer").value;
if(newanser!=""&&newanser!="在此添加问题的答案.")
{
$("answeroptions").options[$("answeroptions").length] = new Option(newanser,newanser);
$("newanswer").value=""; }
else
{
alert("问题答案不能为空");
}
}
function check()
{
if($("questionasked").value=="")
{
alert("问题名称需要填写");
}
else
{
if(!$("dselect").checked)
{
alert("需要选中");
}
else
{
if($("answeroptions").length==0)
{
alert("至少需要填写一个问题答案")
}
else
{
$("choosequestion").options[$("choosequestion").length] = new Option($("questionasked").value,$("questionasked").value);
$("questionasked").value="";
$("answeroptions").length=0;
$("dselect").checked=false;
alert("添加成功");
}
}
}
}
function cancel()
{
if(confirm("如果撤销编辑内容不做保存"))
{alert("取消编辑")}
}
</script>
</HEAD>
<body>
<div class="page">
<div class="top_content"></div>
<div class="mid_content">
<div class="notice">
<span class="mode"><span class="alerm">当前状态:</span>您的问题已添加成功!</span>
<span class="must">必填项</span>
</div>
<!-- 中上部内容开始 -->
<div class="list1">
<h1>问题列表</h1>
<table cellpadding=2 cellspacing=0 border=0>
<form name=questionlist action="" method=post>
<tr>
<td width="110" align=right><b>问卷名称:</b></td>
<td width="18" valign=top><a href="#"></a></td>
<td width="360">
<table cellpadding=0 cellspacing=0 border=0 width=100%>
<tr>
<td width="43%"><a href="#">test</a></td>
<td width="57%" align=right><a href="#" target=_blank></a></td>
</tr>
</table>
</td>
<td width="22"></td>
</tr>
<tr>
<td align=right valign=top><b>问题:</b></td>
<td valign=top><a href="#"></a></td>
<td><select name=choosequestion class=huge id="choosequestion" size=15><option value=90>当前没有此问题的答案</option></select></td>
<td valign=middle>
<table cellpadding=2 cellspacing=0 border=0>
<tr><td><a href="javascript:MoveUp()"></a></td></tr>
<tr><td><a href="javascript:MoveDown()"></a></td></tr>
</table>
</td>
</tr>
<tr>
<td COLSPaN=2></td>
<td COLSPaN=2>
<input type=button onClick="ChangeQuestion()" class="inp" value="编辑">
<input type=button onClick="DeleteQuestion()" class="inp" value="删除">
<input type=button onClick="addPagebreak()" class="inp" value="添加分页">
<input type=button onClick="StoreOrder()" class="inp" value="保存顺序">
<input type=button onClick="PreviewQuestion(7)" class="inp" value="预览">
</td>
</tr>
<input type=hidden name=action class="inp" value="">
<input type=hidden name=deleteid class="inp" value="">
<input type=hidden name=sortorder class="inp" value="">
<input type=hidden name=cs class="inp" value="">
<input type=hidden name=qid class="inp" value="">
</form>
</table>
</div>
<!-- 中上部内容结束 -->
<div class="clear"></div>
<!-- 中下部内容开始 -->
<div class="list2">
<h1>添加/修改问题</h1>
<table cellpadding=2 cellspacing=0 border=0 id=AddLoc>
<form name=addquestion action="" method=post>
<tr>
<td align=right><B>问题名称:</B></td>
<td><a href="#"></a></td>
<td><input type=text name=questionasked class=huge value="" id="questionasked"></td>
<td align=center></td>
</tr>
<tr>
<td align=right><B>类型:</B></td>
<td><a href="#"><a></td>
<td><select name=type classs=large onchance="">
<option selectED value="radio">单项选择</option>
<option value="checkbox">多项选择</option>
<option value="textfield">小文本框</option>
<option value="textarea">大文本框</option>
<option value="select">单选框</option>
<option value="selectmult">多选框</option>
<option value="htmlcontent">引用网页内容</option>
</select></td>
<td align=center></td>
</tr>
<tr>
<td align=right><B>必需的?</B></td>
<td><a href="#"></a></td>
<td><select name=required>
<option value="y">是</option>
<option value="n">否</option>
</select></td>
<td></td>
</tr>
<tr>
<td align=right Valign=top><B>问题选项:</B></td>
<input type=hidden name=answer value="" >
<td Valign=top><a href="#"></a></td>
<td><select name="answeroptions" class="huge" size=10 onChange="" id="answeroptions"></select></td>
<td>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td align=center></td></tr>
<tr><td height=110 Valign=middle>
<table cellpadding=2 cellspacing=0 border=0>
<tr><td><a href="javascript:MoveUpW()"></a></td></tr>
<tr><td><a href="javascript:MoveDownW()"></a></td></tr>
</table></td></tr>
</table>
</td>
</tr>
<tr>
<td COLSPAN=2></td>
<td>
<table cellpadding=0 cellspacing=0 border=0 width=100%>
<tr>
<td width="73%">
<input type=text name=newanswer class=wizard1 onFocus="" value="在此添加问题的答案." id="newanswer" onClick="this.value=''"></td>
<td width="27%" align=right>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><input type=checkbox name=dselect onClick="" id="dselect"></td>
<td class="choice">是否已选?</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td COLSPAN=2>
<td><NOBR>
<input type=button onClick="addAnswer()" class="inp" value="添加选项">
<input type=button onClick="" class="inp" value="增加文本框">
<input type=button onClick="" class="inp" value="修改">
<input type=button onClick="" class="inp" value="删除"></NOBR></td>
<td></td>
</tr> <tr>
<td align=right><B>在列表中显示?</B></td>
<td><a href="#"></a></td>
<td><select name=summary>
<option value="y">是<option selectED value="n">否</option>
</select> </td>
<td></td>
</tr> <tr>
<td width=135 COLSPAN=2></td>
<td COLSPAN=2>
<input type=button class="inp" value="添加问题" onClick="check()">
<input type=button onClick="cancel()" class="inp" value="撤消编辑"></td>
</tr>
<input type=hidden name=action class="inp" value="">
<input type=hidden name=modifyid class="inp" value="">
<input type=hidden name=cs class="inp" value="">
<input type=hidden name=cq class="inp" value="">
<input type=hidden name=next class="inp" value="">
<input type=hidden name=fsubmit class="inp" value="">
</form>
</table>
</div>
<!-- 中下部内容结束 -->
<div class="clear"></div></div>
</body>
</html>
1、在firefox中出现不兼容,即在点击添加问题之后无反应(FF中提示 $("choosequestion")is null)
2、在点击撤销编辑后,在点击确定,页面内容没刷新变空
不知楼上的朋友再帮忙更改下哈,谢谢!
{
if(confirm("如果撤销编辑内容不做保存"))
{
alert("取消编辑")
document.getElementById("要填的id").value="";
}
}
你要什么控件的内容为空,写个id字段,没id字段就name就这2个,搞定!