2010-06-23 101 views

回答

2

不,这不是正确的

alert(window.location.href + "&name=" + encodeURIComponent(name_var) + "&id=" + encodeURIComponent(id_var)); 
  1. 您在代码中有一个语法错误,/遵循window.location.href
  2. 使用连接运算符,+ - myString + "more string"
  3. escape已过时,使用encodeURI()encodeURIComponent()
+2

'encodeURIComponent'。 – bobince 2010-06-23 12:12:29

+0

@bobince:该死的,我一直在困惑他们! – 2010-06-23 12:14:49