Reputation: 53
If you see below, my code allows users to input a field with an ip address and it allows them to remote in. Now I have altered it so after the IP it adds information to the link AFTER but I need it to include the http:/ before auto matically but I have to include it in the input box which is what I dont want:
<p>Please fill in the box with your IP address:
<input type="text" name="prog_site" id="prog_site" value="http://" />
<a href="http://"
onclick="this.href=(document.getElementById('prog_site').value +
'/web/entry/en/websys/atRemote/atRemoteSetupGet.cgi')"
target="_blank">Let's go!</a></p>
I have altered the folowing am I any closer?
<p>Please fill in the box with your IP address:
<input type="text" name="prog_site" id="prog_site" value="http://" />
<a href="http://"
onclick=".value + 'http:// ',this.href=(document.getElementById('prog_site').value +
'/web/entry/en/websys/atRemote/atRemoteSetupGet.cgi')"
target="_blank">Let's go!</a></p>
Upvotes: 0
Views: 193
Reputation: 545
You can do it in rather simpler way.
Create a variable $link='http://';
and then concatenate the ip picked from the textfield with it and then use the $link
as final result.
Upvotes: 0
Reputation: 8851
OK, so I think I've gotten it to work by fixing some typos here and there:
<p>Please fill in the box with your IP address:
<input type="text" name="prog_site" id="prog_site" value="" />
<a href="#"
onclick="this.href = ('http://' + document.getElementById('prog_site').value + '/web/entry/en/websys/atRemote/atRemoteSetupGet.cgi')"
target="_blank">Let's go!</a>
</p>
A fiddle for testing: http://jsfiddle.net/mC4vT/1/
Upvotes: 1