Recently, the Internet has been not very good ~ ~ ~ Unhappy
This article is the simplest way, only for their own testing, after all, there are some unsafe factors.
See the other good way to find all too troublesome, so I summarized.
Is this: there is a piece of code in the Input.html page.
The code contains a form, another index.html page that is filled in action to receive data. Use Get method.
Form form contains an input label below.
When you click Submit, our URL is passed through the address bar to the index.html page.
<form action= "index.html" method= "get" >
homepage:<input type= "url" name= "User_url" >
<input Type= "Submit"/>
</form>
Now we're going to get the information we sent over the index.html page.
<p id= "text" name= "text" >a</p>
<script>
var text=window.location.search;
Gets the value of the following parameter Var loc=text.substring (text.lastindexof ("=") +1,text.length);
document.getElementById (' text '). Innerhtml=loc;
Here's the code I wrote: First of all, there must be a place to display our data, I use the P tag, what the label does not care, it is important to give him an ID.
Window.localtion.search represents the Get address bar. and the following parameters.
such as: index.html?id=1&uname=2
window.localtion.search to obtain is? id=1&uname=2
And sometimes we use the window.localtion.href is to get index.html?id=1&uname=2 the entire address bar
This method can be used to get our parameters, now to do is to remove?
It's too much trouble to look at other people's regular expressions.
Direct substring is OK. Look at the need data in front of that one is what, generally. or =
and then from. or = The following number begins to intercept until the last
Text.substring (text.lastindexof ("=") +1,text.length);
All right. You can do it.