Guest Nova706 Posted March 20, 2009 Share Posted March 20, 2009 I know how to use javascript to expand blocks of text in HTML, basically passing a variable to rewrite a div to be display: block instead of display: none. However, I would like to have a link from one page that opens a second page and expands a text block on that second page.For example:On my about.html page, I have two expanding text blocks. I would like to have a link that navigates from my default.html page to my about.html page and expands the second text block on the about.html page.I believe this has to do with passing a javascript variable (to tell which block to expand) and calling a function on another page through a link... neither of which, I know how to do. Any help or resources would be welcomed. Thanks! Link to comment Share on other sites More sharing options...
jeffman Posted March 20, 2009 Share Posted March 20, 2009 One method:pass the data to the second page in a query string, then use the location.search property to get the query string. You'll have to handle the question mark, but that is not hard.So a link might look like this:<a href="page.html?product_2">Show me Product 2</a>And then the script on page.html would examine location.search, which in this case would equal "?product_2" ;location.search.substr(1) is even better, since it equals "product_2" -- if "product_2" is the id of your hidden div, the rest is easy. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.