<script language="JavaScript">
<!--
function a(f){
var re=/\d*$/
var d=parseInt(f.action.match(re)[0]);
f.action=f.action.replace(re,d+=1)
}
//-->
</script>
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:a(this)" target="_blank">
<input type="submit" value="开始检索" class="submit" name="submit">
</form>
<!--
function a(f){
var re=/\d*$/
var d=parseInt(f.action.match(re)[0]);
f.action=f.action.replace(re,d+=1)
}
//-->
</script>
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:a(this)" target="_blank">
<input type="submit" value="开始检索" class="submit" name="submit">
</form>
请用做成用hidden又该怎么实现嘛. 能不能把代码写出来.谢谢
<script language=JavaScript>
<!--
function newSearch(theForm)
{
var re=/\d*$/
var d=parseInt(theForm.action.match(re)[0]);
theForm.action=theForm.action.replace(re,d+=1)
if(theForm.word.value == "")
{
alert("请您输入检索词!");
theForm.word.focus();
return (false);
}}
//-->
</script>
<form method="POST" action="index.jsp?search=1" name=form1 onSubmit="javascript:return newSearch(this);"> <input type="submit" value="开始检索" class="submit" name="submit">
{
document.form1.hidden1.value=2
}
function newSearch(theForm)
{
var a=ParseInt(document.form1.hidden1.value)+1
f.action="index.jsp?search=" + a.toString()
}
document.form1.hidden1.value=2 //为空或不是对象<script language=JavaScript>
<!--
function window_onload()
{
document.form1.hidden1.value=2 //跳出网页脚本错误,说这为空或不是对象
}
function newSearch(theForm)
{
var a=ParseInt(document.form1.hidden1.value)+1
theForm.action="index.jsp?search=" + a.toString()
if(theForm.word.value == "")
{
alert("请您输入检索词!");
theForm.word.focus();
return (false);
}
}//-->
</script><form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:return newSearch(this);">
<input type="text" name="word" width=100>
<input type="submit" value="开始检索" name="submit">
</form>
<script>
var a=1;
var str="index.jsp?search=";
</script>
<form method="POST" name=form1 onSubmit="document.form1.action=str+a;">
<input type="button" value="开始检索" name="submit" onclick="a++;">
</form>
<script language=JavaScript>
<!--
function newSearch(theForm)
{
var a=1;
var str="index.jsp?search=";
document.form1.action=str+a;
if(theForm.word.value == "")
{
alert("请您输入检索词!");
theForm.word.focus();
return (false);
}}
//-->
</script>
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:return newSearch(this);">
<input type="text" name="word" class=input width=100>
<input type="button" value="开始检索" name="submit" onclick="a++;">
</form>
{
var a=ParseInt(document.form1.hidden1.value)+1
form1.action="index.jsp?search=" + a.toString()
}你没有再html中加
<INPUT type="hidden" value=2 name="hidden1">
<!--
function window_onload()
{
document.form1.hidden1.value=2 //跳出网页脚本错误,说这为空或不是对象
}
function newSearch(theForm)
{
var a=ParseInt(document.form1.hidden1.value)+1
form1.action="index.jsp?search=" + a.toString()
if(theForm.word.value == "")
{
alert("请您输入检索词!");
theForm.word.focus();
return (false);
}
}//-->
</script>
<INPUT type="hidden" value=2 name="hidden1">
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:return newSearch(this);">
<input type="submit" value="开始检索" class="submit" name="submit">
</form>
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:return newSearch(this);">
<INPUT type="hidden" value=2 name="hidden1">
<input type="submit" value="开始检索" class="submit" name="submit">
</form>
我把他的测试过,全部代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<script language="JavaScript">
<!--
function a(f){
var re=/\d*$/
var d=parseInt(f.action.match(re)[0]);
alert(d);
f.action=f.action.replace(re,d+=1)
}
//-->
</script>
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:a(this)" target="_blank">
<input type="submit" value="开始检索" class="submit" name="submit">
<input type="button" name="Submit" value="测试" onClick="a(window.document.form1);">
</form>
</body>
</html>
你要把下面这句放到<form>标识里。也就是改为:
<form method="POST" action="index.jsp?search=2" name=form1 onSubmit="javascript:return newSearch(this);">
<INPUT type="hidden" value=2 name="hidden1"> //我把他放到里面,还是出错,缺少对象
<input type="submit" value="开始检索" class="submit" name="submit">
</form>
那位兄弟帮帮忙,看看是我把程序那里写错了,帮我改改,谢谢了,我快及死了
<script language="JavaScript">
<!--
function newSearch(f){
var re=/\d*$/
var d=parseInt(f.action.match(re)[0]);
//alert(d); //测试这句话,数字按上加,没有问题,
f.action=f.action.replace(re,d+=1)
if(f.word.value == "")
{
alert("请您输入检索词!");
f.word.focus();
return (false);
}
}
//-->
</script><form method="POST" action="index.jsp?search=1" name=form1 onSubmit="javascript:return newSearch(this)">
<input type="submit" value="开始检索" name="submit">
</form>
<html>
<head>
<title>
Jsp3
</title>
</head>
<script language="javascript">
function ch(){
form1.submit();
}
</script>
<body>
<%
String s=request.getParameter("search");
String ss="http://localhost:8080/Jsp3.jsp?search=";
if(s==null)
{
s="2";
}
else
{
int i=Integer.parseInt(s);
i++;
s=String.valueOf(i);
}
out.println(s);
%>
<form method="POST" name="form1" action=<%=ss.concat(s)%>>
<input type="submit" value="开始检索" name="submit" onclick="ch()">
</form>
</body>
</html>
<html>
<head>
<title>
Jsp3
</title>
</head>
<body>
<%
String s=request.getParameter("search");
String ss="http://localhost:8080/Jsp3.jsp?search=";
if(s==null)
{
s="2";
}
else
{
int i=Integer.parseInt(s);
i++;
s=String.valueOf(i);
}
out.println(s);
%>
<form method="POST" name="form1" action=<%=ss.concat(s)%>>
<input type="submit" value="开始检索" name="submit" >
</form>
</body>
</html>
有没有不用固定IP,给个能自动识别IP的程序就好了,不用换了IP就得去改这个文件.
String ss="http://localhost:8080/Jsp3.jsp?search=";