From: <cam...@ya...> - 2001-01-16 16:44:36
|
I've attached a modified version of your example that works in ie and netscape. you need to add the defer parameter to your script tag, and ie sets the variable in the root documents namespace rather than the element. you'll need to repath the api include cheers, cameron. --- Al Byers <by...@lo...> wrote: > > I got some good help from the dynapi-help list, but > not quite all I need > so I am resubmitting this as a question as to > whether or not there > exists or we need an API for accessing Javascript > variables in the > results returned to a LoadPanel. It seems like that > would be a common > use of LoadPanel. I was able to figure out how to do > so > in Netscape, but how would one recode this for IE?: > > el.onload = function(e) { > status = 'got load event '+ > counter++; > var $targ = e.getTarget(); > alert("testvar:" + > $targ.elm.$testvar); //This works for > NS > > -Al > > -------- Original Message -------- > Subject: Accessing javascript variables in LoadPanel > Date: Mon, 15 Jan 2001 08:59:07 -0500 > From: Al Byers <by...@lo...> > To: dyn...@li... > > How does one access Javascript variables in the > LoadPanel? I am confused > as to what I should be looking for. I found a way to > do it in Netscape > (see example below), but I don't know why it works. > In the example, I > don't use setURL, just setHTML, so I guess the > question does not depend > on LoadPanel - it could just as easily be a DynLayer > object. Is there a > method that I am missing? > > <<<<<<<<<<<<<<<<<<<EXAMPLE>>>>>>>>>>>>>>>>>> > <HTML><HEAD> > <!-- will have to change for your environment --> > <script language="Javascript" > src="/dynapi/dynapi.js"></script> > <script language="Javascript"> > DynAPI.setLibraryPath(''); > DynAPI.include('dynapi.api.*'); > DynAPI.include('dynapi.gui.loadpanel.js'); > </script> > > <script language="Javascript"> > DynAPI.onLoad=function() { > $go_dynobj = new LoadPanel(); > $go_dynobj.setHTML("no file loaded"); > > $go_dynobj.setSize(250,50); // height will > be overwritten by > default > $go_dynobj.moveTo(100,100); > $go_dynobj.setBgColor('yellow'); > > counter = 0; > var el = new EventListener($go_dynobj); > el.onload = function(e) { > status = 'got load event '+ > counter++; > var $targ = e.getTarget(); > alert("testvar:" + > $targ.elm.$testvar); //This works for > Netscape. Why? > } > $go_dynobj.addEventListener(el); > > DynAPI.document.addChild($go_dynobj); > > return; > } > > function go( ) > { > var $s = '<html><head><script > language="javascript">var > $testvar="OK";\x3C/script>' > + '</head><body >' > + 'HERE I AM' > + '</body></html>'; > > $go_dynobj.setHTML($s); > return; > } > </SCRIPT> > </HEAD> > <BODY BGCOLOR="white" > > <a href="javascript:go()">Load Panel</a> > </BODY> > </HTML> > <<<<<<<<<<<<<<<<<<END OF EXAMPLE>>>>>>>>>>>>>>>>>> > > -- > Al Byers > Local Square, Inc. > 826 N. Augusta St. > Staunton, VA 24401 > 540.213.0500 > www.localsquare.com > by...@lo... > > _______________________________________________ > Dynapi-Widgetdev mailing list > Dyn...@li... > http://lists.sourceforge.net/lists/listinfo/dynapi-widgetdev > > __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |