By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Resetting window.location.href

P: 15
I have a text box that updates my url everytime a value is selected. This is appended to the url:

eg. http://localhost/test/default.aspx?id=1

If I cange my mind and want t adifferent id, I select it and my url gets updated again:

eg. http://localhost/test/default.aspx?id=1&id=2

How can I adjust it so that my url remains properly intact?

eg. http://localhost/test/default.aspx?id=2
Jun 21 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,208
well lets see your code but I would do something like
Expand|Select|Wrap|Line Numbers
  1. url = window.location.href;
  2. if (url.indexOf("?")>0) { url = url.split("?")[0]; }
  4. window.location = url + "?id=" + whateveryourdoing;
Jun 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.