<script language=javascript>
function check()
{
if ((document.frm.str1.value)!=(document.frm.str2.value))
{
alert("不相等")
document.frm.str1.focus()
}
else
document.frm.submit()
}
</script>
<form name=frm action="doit.jsp">
<input type=text name=str1>
<input type=text name=str1>
<input type=button onclick="check()">
</form>
function check()
{
if ((document.frm.str1.value)!=(document.frm.str2.value))
{
alert("不相等")
document.frm.str1.focus()
}
else
document.frm.submit()
}
</script>
<form name=frm action="doit.jsp">
<input type=text name=str1>
<input type=text name=str1>
<input type=button onclick="check()">
</form>
<input type=text name=str1>
应该是
<input type=text name=str1>
<input type=text name=str2>
但是,我原来是想用jsp对字串做一些处理的,因为我要的是一个产品名与对应的产品名的文件名,比如:产品(电视机),文件名(电视机.doc)
//产品的文件名要对应产品是我们已经规定好的!
我原来是用jsp取得文件名的前部分(比如 电视机.doc在点前的部分),但您的程序则只好使用javascript做处理了,不知您能否帮忙帮到底?!
另外,您所提供的程序好象只有一个确认按钮,没有取消的呀?!麻烦您了!
function check()
{
if ((document.frm.str1.value)!=(document.frm.str2.value))
if(confirm("不相等,重新填写"))
document.frm.str1.focus()
else
document.frm.submit()
}