How to Execute Javascript Code Using Variable in URL -
I'm really new to javascript and I have some problem how to get the following to work. My goal is to execute a certain JavaScript action, when a page loads and a variable added at the end of the URL that executes the Javascript Action. The URL of the page on which I want to apply it Each of the "Extended" buttons, which operates JavaScript, drop-downs of a fixed area of the page Finally, I would like to be able to create a URL which will automatically drop down a certain category when the page is loaded. Can anyone explain this process to me? Thanks in advance for any help!
You already have a call calling function: Then use that number as a regular expression using the , to make your two parameters and call This should work: toggle2 () , Which, in the end, takes two parameters to be equal for all categories except for a number, then create the URL that contains the number:
location Find in .hash . It's strong enough to handle multiple URL parameters, so you should decide to use them in the future:
/ [\ # & amp;] cat = (\ d +) / but , If you never add anything else to the URL, you can use one very easy one like
/ (\ d +) / .
toggle2 () , this is a simple matter to use that number.
window onload = function () {if (/[\#&]cat=(\d+)/.test(location Hash)) {var cat = parseInt (RegExp $ 1); If (cat & gt; & amp; amp; & amp; & amp;; & amp;; cat & lt; 13) {toggle2 ("Toggle" + Cat, "displayText" + Cat); }}}
Comments
Post a Comment