Taco
Looks
like your object reference if getting lost after the first function
recurence
probably not what you want but it works
<script>
// retrieve a form name from an object
formName = "";
function getFormName( obj )
{
var parent = obj.parentElement;
if ( parent.tagName == 'FORM')
{formName = parent.name;}
else
{getFormName( parent );}
}
</script>
<form name="bla">
<span id="spanID"><font><blockquote>
<div id="inDiv">sadfasf</div>
</blockquote></font></span>
</form>
<script>
getFormName(document.getElementById("inDiv"))
alert(formName);
</script>
<span id="spanID"><font><blockquote>
<div id="inDiv">sadfasf</div>
</blockquote></font></span>
</form>
<script>
getFormName(document.getElementById("inDiv"))
alert(formName);
</script>
-----Original
Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Taco Fleur
Sent: Tuesday, 20 January 2004 8:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: [OT] Undefined JS - why?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Taco Fleur
Sent: Tuesday, 20 January 2004 8:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: [OT] Undefined JS - why?
---nope that ain't it either.try// retrieve a form name from an object
function getFormName( obj )
{
var parent = obj.parentElement;
if ( parent.tagName == 'FORM')
{
var formName = parent.getAttribute('name');alert(formName); *********************************************************************
return formName
}
else
{
getFormName( parent );
}
}You'll see it works, it just won't return the valueTaco Fleur0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn--------Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Onnis
Sent: Tuesday, 20 January 2004 7:06 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: [OT] Undefined JS - why?try something other than parent cause I would say its reserved--------Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Taco Fleur
Sent: Tuesday, 20 January 2004 6:19 PM
To: CFAussie Mailing List
Subject: [cfaussie] [OT] Undefined JS - why?I can't figure out why the following function keeps returning undefined// retrieve a form name from an object
function getFormName( obj )
{
var parent = obj.parentElement;
if ( parent.tagName == 'FORM')
{
var formName = parent.getAttribute('name');
return formName
}
else
{
getFormName( parent );
}
}While if I put a alert within the function I can see formName is populated with a correct valueAny ideas?Taco Fleur0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
