日期:2014-05-16 浏览次数:20577 次
<script language="javascript">
function Search()
{
keyword=document.getElementById("<% =Search.ClientID%>").value;
document.location="Search.aspx?KeyWord="+escape(keyword);
}
window.onload=function(){
var url=document.location.toString();
var array=url.split("KeyWord=")
if(array.length>1)
document.getElementById("<% =Search.ClientID%>").value=unescape(array[1]);
else
document.getElementById("<% =Search.ClientID%>").value="";
}
</script>
<script language="javascript">
function Search() //Search 方法
{
keyword=document.getElementById("<% =Search.ClientID%>").value; //取id 为Search.ClientID (jsp里的赋值方式) 值 ;
document.location="Search.aspx?KeyWord="+escape(keyword); //本页面重载为 Search.aspx 带参数;
}
window.onload=function(){ // 页面加载时调用
var url=document.location.toString(); //取到本页面url
var array=url.split("KeyWord=") 用KeyWord=去分割url 为一个数组 array
if(array.length>1) //如果 KeyWord 有值 即 array.length>1
document.getElementById("<% =Search.ClientID%>").value=unescape(array[1]); //给 KeyWord 赋值 为url里 KeyWord 的值
else
document.getElementById("<% =Search.ClientID%>").value=""; //否则为空
}
</script>