开发者

Redirection in Javascript

I Have the following code i am trying to redirect the page to the same page but with a int on the link but it keeps coming up with page error.

 var done_update = '&update开发者_JAVA技巧d=1';
 window.location = window.location.href.done_update;

Thank you,


String concatenation is done in JavaScript (and Java for that matter) using a + and not a .:

var done_update = '&updated=1';
window.location = window.location.href + done_update;


var done_update = '&updated=1';
window.location = window.location.href+done_update;


var done_update = "&update=1";
location = location.href + done_update;
  1. String concatenation in JavaScript is done using the + operator, not . as in other languages (Perl, PHP...)

  2. location is a global variable, there is no need to specify window.location

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜