inserting a variable into a MM_goToURL link

Joined
Feb 29, 2012
Messages
2
Reaction score
0
I am new to this, and after I've searched a bunch of forums and tried it on my own I didn't succed in accomplishing what I wanted, i.e. :

I want to have a text field, in which I will write a number. Then i want a Button to have a MM_goToURL on click action to a Link which has a variable in it with the value from the input text field.

To be more precise here is a part of the code:

the MM_goToURL function:

<script type="text/javascript">
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args[i+1]+"'");
}
</script>

My text field:

<input name="12" type="text" id="ip" value="1" />

My Button:

<input name="3" type="submit" id="GO" onclick="MM_goToURL('parent','1.1.1.my_var');return document.MM_returnValue" value="Submit" />
<label for="1"></label>

So how can I declare my_var so it will always take the value inside the Input text field, and how do I include that variable inside the link, because just plain writing the name of the variable in there like :MM_goToURL('parent','1.1.1.my_var') won't work.

Thank you.
 
Joined
Feb 29, 2012
Messages
2
Reaction score
0
I got it working but with another function not MM_gotoURL

<script type="text/javascript">
function doit1() {
var x = document.getElementById('ip1').value
window.open('http://1.1.1.'+x)
}
</script>

<input type="submit" name="first" id="first" onclick='doit1()' value="Go to Board" />
<input name="ip" type="text" id="ip1" value="" size="10"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top