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

passing value from one html to another

P: 1
I have inserted a function to help me pass a value from one html page to a drop down box in another html page. The problem is the code is working only in IE and not in Firefox.

The code in the first page :-

Expand|Select|Wrap|Line Numbers
  1. <a href="reservation.html?rooms=0">Book Now</a>
The code in the 2nd page :-

Expand|Select|Wrap|Line Numbers
  1.   <script type="text/javascript">
  2. function parseState()
  3.         {
  4.               var q = unescape(location.search);
  5.               q = q.substring(7, q.length);
  6.           if (q != "")
  7.           {
  8.             document.getElementById('rooms').options.selectedIndex = q;
  9.           }
  10.         }
  11.     </script>
Sep 25 '08 #1
Share this Question
Share on Google+
1 Reply


P: 93
Hi friend in firefox the query string is not getting parsed correctly.

The code you have written is a bit dependant becoz here you know about url exactly that after 7 characters there is your query but here is the most independant and efficient way of doing the same
Expand|Select|Wrap|Line Numbers
  1. q=location.search.substring(1);
  2. alert(q);//will give you every thing after the query parameter which you can split further for multiple parsing
Sep 25 '08 #2

Post your reply

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