user2584481
user2584481

Reputation: 53

Adding string to the end of submitted URL?

I am putting together a simple tool for work where a user can add in some data to a form field which allows them to remotely access a device, but I need it to take them to the the login page.

<input type="text" name="prog_site" id="prog_site" value="http://" />
<a href="http://" onclick="this.href=document.getElementById('prog_site').value" target="_blank">Let's go!</a>

the above takes them to the said device, but I am having problems with adding a script that then adds on the following after the submitted info (which is an IP address)

/web/guest/en/websys/webArch/authForm.cgi

I have been looking at ways but need it to be as simple as possible?

Here is the full script:

    <script>
function open_win() 
{
window.open("");
}
</script>

<style>
body {
background-color: #fff;
}
</style>

<p><img src="logo.gif" /></p>

<p>Hello customer</p>

<p>Welcome to the Activation</p>

<p><a target="_new" href="">Instructions</a></p>


<input type="text" name="prog_site" id="prog_site" value="http://" />
<a href="http://" onclick="this.href=document.getElementById('prog_site').value" target="_blank">Let's go!</a>

Upvotes: 1

Views: 2072

Answers (4)

dbanet
dbanet

Reputation: 695

JSFiddle

<input type="text" name="prog_site" id="prog_site" value="http://" />
<input type="button" value="Let's go!" onclick="window.location.replace('http://web/guest/en/websys/webArch/authForm.cgi?ip='+document.getElementById('prog_site').value); return true;"></input>

Upvotes: 0

Ishan Jain
Ishan Jain

Reputation: 8161

Your question not clear for me. But i think you want to add a QueryString into your URL. So you can simply add this using ? symbol.

var URL = "YourURL";
    URL = URL + "?IP=" + "YourString"; 

After Update -

<a href="http://" onclick="this.href=(document.getElementById('prog_site').value +'/web/guest/en/websys/webArch/authForm.cgi')" target="_blank">Let's go!</a>

Upvotes: 0

Josh
Josh

Reputation: 2895

Is this what you are trying to achieve?

<input type="text" name="prog_site" id="prog_site" value="http://" />
<a href="http://" onclick="this.href+=('/web/guest/en/websys/webArch/authForm.cgi?ip=' + document.getElementById('prog_site').value); return true;" target="_blank">Let's go!</a>

Upvotes: 0

Adrian Wragg
Adrian Wragg

Reputation: 7401

Possibly I'm misreading the question, but what is wrong with:

<a href="http://"
    onclick="this.href=(document.getElementById('prog_site').value +
                       '/web/guest/en/websys/webArch/authForm.cgi')"
    target="_blank">Let's go!</a>

?

Upvotes: 1

Related Questions