The javascript| page recently had a strange need to pass parameters between static pages
I can't think how to solve pure HTML static page How to get the parameters?
Then suddenly thought of javascript all solved ...
Let me tell you a little bit about using JavaScript to accept parameters on a static page.
It's really simple. As long as the user opens the page URL with parameters
and JavaScript can get the URL of the current page simply parse the URL that gets it
Let's take a look at my code. Just embed the code in the paging file
<script>
Urlinfo=window.location.href; Gets the URL of the current page
len=urlinfo.length;//gets the length of the URL
Offset=urlinfo.indexof ("?"); /sets the position at which the parameter string starts
NEWSIDINFO=URLINFO.SUBSTR (Offset,len)//Fetch parameter string This will get a string like "id=1"
Newsids=newsidinfo.split ("=");//To split the obtained argument string by "="
newsid=newsids[1];//get the parameter value
Alert ("The parameter value you want to pass is" +newsid);
</script>
But be sure to remember that this method is only useful for URLs that contain parameters
If the other side uses the Post method to pass the parameter URL, it will not contain parameters.
So this trick is only useful for get methods or URLs that specify parameters.