<script type="text/javascript">
function test(id){
var temp = window.location.href +"?" +"id=";
var url= temp + id;
location.href = url;
}
</script>当click事件触发后,会取得id,放在地址栏里面,比如www.test.com?id=1
这是我第一次点击获取的id。可是问题出现了,当我点击第二次,第一次的地址栏的id并没有清除,会变成
www.test.com?id=1?id=2这样我在后台取值就会报错,怎样才能解决啊?
function test(id){
var temp = window.location.href +"?" +"id=";
var url= temp + id;
location.href = url;
}
</script>当click事件触发后,会取得id,放在地址栏里面,比如www.test.com?id=1
这是我第一次点击获取的id。可是问题出现了,当我点击第二次,第一次的地址栏的id并没有清除,会变成
www.test.com?id=1?id=2这样我在后台取值就会报错,怎样才能解决啊?
解决方案 »
- 这段代码什么意思top.location=self.location;
- Aptana的使用问题
- jquery如何取消onfocus事件
- Javascript查询XML问题
- 关于javascript事件的疑问,请大家帮忙看下是什么原因!!###[100分]###
- vml生成的图片导入word 怎么导阿〉? 求救!
- javascript 函数 里面绑定数据 的问题!!!! 在线等!!!
- jquery中的validate控件出现错误验证提示后,如何清空错误,变成就像没执行验证的时候一样?
- 正则表达式问题
- 借个地方提问一下只因这儿人气好
- 有高手帮我看下这个怎么做? 在线等!!!!
- XML cannot be the whole program
if(temp.indexOf("?")>-1)
temp = temp.split("?")[0]temp +="?" +"id=";