From: Bill W. <bil...@us...> - 2000-12-06 19:21:02
|
Perhaps, after the page loads, you could go and get the loadpanel's document.links array, and the iterate through them all and add to them a target window, namely the layer you want them to show up in. I hope this works, because I plan on doing something like that. "Cameron Hart" <ca...@bi...> wrote: > > I'm not sure if this is what you're looking for, but why not try > > something like ... > > > > <a href="#" onClick="whateverLayer.setHTML('page.html')">My Link</a> > > > > If you don't know what whateverLayer is in adavnce, you could use > > document.write to change the name of the layer. > > that works if you know what whatevenLayer is, but unfortunately I don't. I > thought that the document loaded into the loadpanel would know what > whateverLayer is (ie the layer it got loaded into) but it doesn't seem to. > > I'm not what you mean by using document.write to change the name of the > layer? > > Thanks, > > Cameron. > > > > > Let me know if you come across a better solution, or indeed if > > anyone has come across a > > solution to submitting a form and giving it a target inside a loadpanel. > > > > Mark > > > > Cameron Hart wrote: > > > > > I've got a question about links inside html files loaded into a > > loadpanel. > > > > > > I am building a site that uses multiple loadpanels at the same time. All > > > these loadpanels contain external html documents. Some of these > > documents > > > have links in them. If you click on a link in a document loaded in a > > > loadpanel, it loads the new page over the top of the main > > window, not into > > > the loadpanel. That's not good ;-) > > > > > > I've tried making the links javascript calls to call a setURL > > to load a new > > > document in the same loadpanel. The problem is that the > > document inside the > > > loadpanel doesn't seem to be "aware" of what loadpanel it is > > in. It's parent > > > appears to be the top level DynDocument, not the LoadPanel object. > > > > > > Does anyone have any ideas on how I can tell a document loaded into a > > > loadpanel, this is your loadpanel, use setURL on this? > > > > > > Thanks, > > > > > > Cameron. > > > > > > _______________________________________________ > > > Dynapi-Help mailing list > > > Dyn...@li... > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > > > > _______________________________________________ > > Dynapi-Help mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-help ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 |
From: Scott A. L. <sc...@sc...> - 2000-12-06 20:15:16
|
You should be able to use an afterload event to trigger the iteration through the layer's document. Assuming the document is not from another domain, you could use this to rewrite all links. The loadpanel and loadHTML extension both already attach the calling layer as a property to the link, as .lyrobj, so you could just extend this loop to rewrite the link as well: - assign the calling layer as a property of the link (in .lyrobj) - preserve the original href somehow, like: links[i]._href = links[i].href - replace the existing href with a void return: links[i].href = "javascript:void(0);" - assign an onclick handler to the links: links[i].onclick = LoadPanel.handleClick Then all you have to do is write the handleClick: LoadPanel.handleClick = function(){ this.lyrobj.loadHTML(this._href) } I suppose you could also change other things in the link, like the status bar message and whatnot. This would probably work for pure navigation links, not for links that already use the "javascript:" protocol. That would cause some weird problems. scottandrew Bill Wheaton wrote: > > Perhaps, after the page loads, you could go and get the loadpanel's > document.links array, and the iterate through them all and add to them a > target window, namely the layer you want them to show up in. I hope this > works, because I plan on doing something like that. > > "Cameron Hart" <ca...@bi...> wrote: > > > I'm not sure if this is what you're looking for, but why not try > > > something like ... > > > > > > <a href="#" onClick="whateverLayer.setHTML('page.html')">My Link</a> > > > > > > If you don't know what whateverLayer is in adavnce, you could use > > > document.write to change the name of the layer. > > > > that works if you know what whatevenLayer is, but unfortunately I don't. I > > thought that the document loaded into the loadpanel would know what > > whateverLayer is (ie the layer it got loaded into) but it doesn't seem to. > > > > I'm not what you mean by using document.write to change the name of the > > layer? > > > > Thanks, > > > > Cameron. > > > > > > > > Let me know if you come across a better solution, or indeed if > > > anyone has come across a > > > solution to submitting a form and giving it a target inside a loadpanel. > > > > > > Mark > > > > > > Cameron Hart wrote: > > > > > > > I've got a question about links inside html files loaded into a > > > loadpanel. > > > > > > > > I am building a site that uses multiple loadpanels at the same time. > All > > > > these loadpanels contain external html documents. Some of these > > > documents > > > > have links in them. If you click on a link in a document loaded in a > > > > loadpanel, it loads the new page over the top of the main > > > window, not into > > > > the loadpanel. That's not good ;-) > > > > > > > > I've tried making the links javascript calls to call a setURL > > > to load a new > > > > document in the same loadpanel. The problem is that the > > > document inside the > > > > loadpanel doesn't seem to be "aware" of what loadpanel it is > > > in. It's parent > > > > appears to be the top level DynDocument, not the LoadPanel object. > > > > > > > > Does anyone have any ideas on how I can tell a document loaded into a > > > > loadpanel, this is your loadpanel, use setURL on this? > > > > > > > > Thanks, > > > > > > > > Cameron. > > > > > > > > _______________________________________________ > > > > Dynapi-Help mailing list > > > > Dyn...@li... > > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > > > > > > _______________________________________________ > > > Dynapi-Help mailing list > > > Dyn...@li... > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > > > > _______________________________________________ > > Dynapi-Help mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > > ____________________________________________________________________ > Get free email and a permanent address at http://www.netaddress.com/?N=1 > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-help -- scott andrew lepera ----------------------------------- web stuff: www.scottandrew.com music stuff: www.walkingbirds.com |
From: Scott A. L. <sc...@sc...> - 2000-12-06 21:21:18
|
My mistake: the current version of loadpanel doesn't seem to use the .lyrobj idea. No problem. Here's a quick run at a link-rewriter function. This only works in Netscape 4.x -- I still can't get the loadpanel to work in IE5 (what's up with that?), so I couldn't test it in that browser. Anyway, it seems to work fine in NS. If someone wants to modify it for IE, please do. Add these static methods to the loadpanel.js code: LoadPanel.rewriteLinks=function(e){ var lyr = e.getSource(); var l = lyr.doc.links; for (i=0;i<l.length;i++){ l[i].lyrobj=lyr l[i].orig_href = l[i].href; l[i].href ="javascript:void(0);"; l[i].onclick=LoadPanel.handleClick; l[i].onmouseover=LoadPanel.handleMouseover; } }; LoadPanel.handleMouseover = function(){ status=this.orig_href; return true; } LoadPanel.handleClick = function(){ this.lyrobj.setURL(this.orig_href) } To use it, add the following eventlistener to your loadpanel: var el = new EventListener(); el.onload = LoadPanel.rewriteLinks; lp.addEventListener(el); When the panel is done loading, the rewrite will be invoked on this panel, and point the links to load in the panel instead of the browser. The LoadPanel.handleMouseover will take care the the status bar, so you won't be seeing "javascript:void" down there. Of course this approach will also wipe out any pre-exisiting onclick events in the link, so it's not meant to be used for everything. -- scott andrew lepera ----------------------------------- web stuff: www.scottandrew.com music stuff: www.walkingbirds.com |
From: Cameron H. <ca...@bi...> - 2000-12-07 10:07:29
|
> My mistake: the current version of loadpanel doesn't seem to use the > .lyrobj idea. The .lyrobj seems to point to the parent DynDocument, not the parent DynLayer (the LoadPanel). > No problem. Here's a quick run at a link-rewriter function. This only > works in Netscape 4.x -- I still can't get the loadpanel to work in IE5 > (what's up with that?), so I couldn't test it in that browser. Anyway, > it seems to work fine in NS. If someone wants to modify it for IE, > please do. The LoadPanel works in IE5 for me. But I cannot access the loaded html's document object. I get a "Not Implemented Yet" error. I might try and force IE5 to use the IE4 method and see if I have any more success. > Add these static methods to the loadpanel.js code: Thank's for that, I'll try it... > When the panel is done loading, the rewrite will be invoked on this > panel, and point the links to load in the panel instead of the browser. > The LoadPanel.handleMouseover will take care the the status bar, so you > won't be seeing "javascript:void" down there. Of course this approach > will also wipe out any pre-exisiting onclick events in the link, so it's > not meant to be used for everything. It is probably possible to check for an existing onClick and save it so it gets executed? I don't know if doing this just for links is the ideal solution. Form's for example will have the same problem. > http://lists.sourceforge.net/mailman/listinfo/dynapi-help |