Reputation: 1
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 depending on an onclick
from the previous page. Totally stumped here. Any help is greatly appreciated.
Upvotes: 0
Views: 167
Reputation: 104178
One way to solve this is to pass parameters in the query string:
reader/index.html?func=function1
reader/index.html?func=function2
You can read a query string parameter in javascript by using a technique described here.
Upvotes: 1