form.action?

S

SirDarckCat

Hi I'm having a problem interacting with forms..

If I have this:

<form action="abc.php" name="blah">
<input name="action" value="xyz">
</form>

document.forms.blah.action is xyz

How can I get abc.php (without regexing outerHTML)?

Greetz!!
 
E

Evertjan.

SirDarckCat wrote on 20 okt 2007 in comp.lang.javascript:
Hi I'm having a problem interacting with forms..

If I have this:

<form action="abc.php" name="blah">
<input name="action" value="xyz">
</form>

document.forms.blah.action is xyz

How can I get abc.php (without regexing outerHTML)?

IE7 tested:

<body>
<form action="abc.php" name="blah">
<input name="action" value="xyz">
</form>

<script type='text/javascript'>

var temp = document.forms[0].innerHTML
document.forms[0].innerHTML = ''
var actionVal = document.forms[0].action
document.forms[0].innerHTML = temp

alert(actionVal)

</script>
 
T

Thomas 'PointedEars' Lahn

SirDarckCat said:
Hi I'm having a problem interacting with forms..

If I have this:

<form action="abc.php" name="blah">
<input name="action" value="xyz">
</form>

document.forms.blah.action is xyz

How can I get abc.php (without regexing outerHTML)?

Don't use `action' for the name of the control (or `name', or
`submit', or any other already used property name), then use
the standards-compliant

document.forms["blah"].action

However, most certainly you won't need the `document.forms["blah"]'
part as you can pass a reference to the object with `this.form'.


PointedEars
 

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

No members online now.

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,394
Latest member
Olekdev

Latest Threads

Top