Anytime that I'm working with document object references, I always create an
object using the eval function.  Also, you are passing a string to your
function, not an object or an object reference.  so you should have your
value enclosed in single quotes.

So, for your function I would do the following:

<script type="text/_javascript_">
function toggleDrillDown(tblObj){
  // Set an object reference to the table
  tblref = eval("document.getElementById('" + tblObj + "')");

  if(tblref.style.display == 'block'){
    tblref.style.display = 'inline';
  } else {
    tblref.style.display = 'block';
  }
}
</script>

<a href="" #x#</a>

<table id="tbl#x#" border="1">
...
</table>

Hope this helps!

Jeff Garza

----- Original Message -----
From: Tangorre, Michael
To: CF-Community
Sent: Wednesday, June 09, 2004 11:18 AM
Subject: JS Question

Ok, I posted this over at CF-TALK but no luck...

I keep getting an object expected error... but I thought I was passing the
object in!

<cfloop from="1" to="5" index="x">

<a href="" #x#</a>

<table id="tbl#x#">...</table>

</cfloop>

Here is my JS function...

toggleDrillDown(tblObj)
{
if(document.getElementById(tblObj).style.display == 'block')
    document.getElementById(tblObj).style.display = 'inline';  else
    document.getElementById(tblObj).style.display = 'block'; }

Can someone explain how I passin the "object". tbl#x# does not work. Nor
does document.getElementById(tbl#x#).

Thanks!

Mike
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to