combo javascipt and html question

B

bbxrider

sorry if this is the wrong newsgroup but not sure which html group it would
be if really more a html question
i'm trying to figure a way to enter a value for my form action target right
on the webpage
like this,
<FORM method="Post" action="perl4.pl".........
i've tried setting a javascript variable to a value entered in a form
textfield, and using that variable, eg. action=variableName,
action=""variableName"", etc
but can't seem to find anything that works
i'm testing various scripts and its a hassle to have to keep editing my
webpage and resaving it each time i have new script name
and am thinking this would have other testing applications if it can work
for other page parameters besides form/action
 
L

lallous

hi,

Once a variable have the value you want, you can modify the form's action
property as:

<script>
document.yourform.action = YourVariable
</script>

<form name="yourform">
</form>

hope that hints,

Regards,
Elias
 
B

bbxrider

thanks for all the help
i guess there are a few ways to do it
i ended up calling a function, setAction()

return setAction(this.form)

function setAction(f) {
f.action=f.elements[n].value;
return;
}
still strugglling with this.form vs document.forms

Eric Bohlman said:
document.forms('yourFormName').action = yourURL;

document.forms['yourFormName'].action = yourURL;
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top