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 |