用表单post方法对p赋值
用html接受
然后用JavaScript将p值写出来
我用
var p=Request.form(p))
if (p="undefined")
{p=1}
不好用
p始终=undefined
为什么?
能实现吗?
应该怎么写?
不可以
cant
不能接收
faint,将server和client的概念搞清楚,就知道是否可以了
是嘛,Request.form是服务器端语句。
<SCRIPT LANGUAGE="JavaScript">
<!--
/**
* 取得当前页的参数值
* gzh_seagull@163.com
*
*/
function Request(){
var srch = window.location.search;
if (srch.length==0) return null;
srch = srch.substring(1,srch.length-1);
this.nv = srch.split("&");
this.names = new Array();
this.values = new Array();
for (var i=0;i<this.nv.length;i++){
var tmp = this.nv[i].split("=")
this.names[i] = tmp[0];
this.values[i] = tmp[1];
}
this.getValue = function(name){
for(var i=0;i<this.names.length;i++){
if (this.names[i] == name) return this.values[i];
break;
}
return null;
}
return this;
}
var curReq = new Request();
alert(curReq.getValue("name")); //if (href==url?name=gzh&id=1) return gzh;
//-->
</SCRIPT>
这是get不是post吧?
get是通过分解url来实现的,并不是真正的接收