I wonder if there's a way to do the following:
I have a page on root: "index.html" that has 2 links. Each link has an onclick
that directs to "reader/index.html". The reason for the two links is because I want the links to call different functions on "reader/index.html" immediately after the page is loaded. Is there a way to do this?
I know how to use onload
to call a function after a page finished loading, but can't figure out how to use onload
to call different functions dependi开发者_开发百科ng on an onclick
from the previous page. Totally stumped here. Any help is greatly appreciated.
One way to solve this is to pass parameters in the query string:
- First link:
reader/index.html?func=function1
- Second link:
reader/index.html?func=function2
You can read a query string parameter in javascript by using a technique described here.
You need to pass state to reader/index.html.
精彩评论