[thelist] Javascript question....

Bruce Douglas bedouglas at earthlink.net
Tue Jun 17 20:41:56 CDT 2003


if i understand what you're trying to do... you're basically trying to
display a list/text/etc.. using a given function and that the function is no
longer where you exoect it when you've gone down a couple of levels in your
app....

if this is correct.. you might consider dividing your app into frames..and
using a hidden frame as the repository for your jscript code... this would
provide the ability to have your jscript code always be where you expect
it....

the downside would be that some of your users may have issues with your use
of frames...

good luck...


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org]On Behalf Of Alexander C. Garcia
Sent: Tuesday, June 17, 2003 1:31 PM
To: Evolt
Subject: [thelist] Javascript question....


Greetings everyone

  Before I begin I must re-iterate that I am a JavaScript newbie, now for my
little dilemma....

  I'm in the midst of publishing a DHTML website, that uses the JavaScript
innerHTML method to dynamically display text, images, etc. that are
requested through a link. I've gotten it to work fine, but when I try to
call the sub routine (function) that is nested 2 pages down it breaks.

For example this works fine:

Main Page >> (click on link) >> dynamic page loads.

But if I click on a link from the dynamically created page, it breaks using
the same method.
For example:

Main page >> (click on link) >> dynamic page loads >> (click on another
link) >> *breaks*
This is the code I use in an external JavaScript file (borrowed from
NetDev);

<code>

/*
 * Data Binder
 */

function iframeCallback(doc, tag) {
  myData = doc.getElementById(tag);
  try {
    textDiv.removeChild(textDiv.firstChild);
    textDiv.innerHTML = myData.innerHTML;
  }
  catch(e) {
    alert("ERROR: " + e);
  }
}

</code>

The code that calls the function gives it a 'document' object from that
page, along with the division id so it knows what to extract. Here's the
code..

<code>

<body onload="top.iframeCallback(document, 'clubs');">

</code>

I assume that the reason the nested page doesn't work is because the
'top.iframeCallback" is referring to the page that contains the link,
instead of the main page which actually contains the link to the function.
At least that's what I can derive form the error's I'm receiving in Opera.

Assuming I'm write what the best way to reference the 'original' or 'main'
page since 'top' only refers to the parent. I need some hierarchy object
reference, which references the original 'main' page. I hope this doesn't
sound like gibberish, if you need more code I can post.

Thank you very much.


Peace be with you.

Alexander Garcia
Alexander at Garcia.Name


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

Evolt.org conference in London, July 25-27 2003.  Register today at
http://evolt.org.uk

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list