21,886
社区成员
发帖
与我相关
我的任务
分享
<!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/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>
javascript 向php传递敏感字符串
javascript : encodeURIComponent( html )
php::$html [直接获得,和urlencode得到的数据一样]
php向javascript传递敏感字符串
php:htmlspecialchars( $html )
javascript: decodeURIComponent( html )
var str = document.free.edit.value;
if(str){
document.action = "news.php?v="+escape(str);
}