<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function checkSubmit() {
var kw = document.getElementById('kw').value;
if (kw.length < 1) {
alert('请输入!');
return false;
}
return true;
}
</script>
</head>
<body>
<div id="fm">
<form name="free" method="get" action='news.php' onsubmit="return checkSubmit();">
<input type="text" name=edit class="STYLE2" id="kw" maxlength="150">
<span class="btn_wr">
<input type="submit" class="btn" id="su" value="检 索" >
</span>
</form>
</div>
</body>
</html>
首先判断输入框edit的内容是否为空,若非空跳转到news.php页面,且把值传给news.php中的edit2。
以上代码该怎么写。本人是PHP初学,请大哥大姐指点。。。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>无标题文档</title>
<script type="text/javascript">
function checkSubmit() {
var kw = document.getElementById('kw').value;
if (kw=="") {
alert('请输入!');
return false;
}
return true;
}
</script>
</head>
<body>
<div id="fm">
<form name="free" method="get" action='news.php' onsubmit="return checkSubmit();">
<input type="text" name=edit class="STYLE2" id="kw" maxlength="150">
<span class="btn_wr">
<input type="submit" class="btn" id="su" value="检 索">
</span>
</form>
</div>
</body>
</html>