Hi There

I have been trying to dynamically change the links in files that are
loaded into a loadpanel so that the appropriate links (those from the
same domain) are loaded into the loadpanel and those from outside the
domain are loaded in the full browser window.

I have run into a few challenges.

The first is that external links from a loadpanel give a security
warning.  I seem to have resolved this (thanks to Eytan Heidingsfeld
pointer) by creating an extension to LoadPanel to fire off external
links.

DynLayer.prototype.sendextURL = function(extURL) {
        feedextURL(extURL)
}

function feedextURL(extURL) {
        window.location = extURL
}

The second is that I have modified some code posted by Scott Andrew
LePera to rewrite the links in a loadpanel once the page is loaded, but
this only works for Netscape (see code below).  Can anyone tell me how
this has to be modified to work for IE as well?:

LoadPanel.prototype.rewriteLinks=function(){
 
        this.l = this.doc.links;
        for (i=0;i<this.l.length;i++){
                this.l[i].orig_href = this.l[i].href.toString();
                this.l[i].href ="javascript:";
                hrefstr = this.l[i].orig_href;
                if
(hrefstr.substr(0,41)=='http://wwwin-asiapac-dev.cisco.com/it/hr/')
this.l[i].onmousedown=redirintlinks;
                else this.l[i].onmousedown=redirextlinks;
                this.l[i].onmouseover=showlinks;
                this.l[i].onmouseout=hidelinks;
        }
}

function redirintlinks(e) {
someloadpanel.setURL(this.orig_href); return false;
}

function redirextlinks(e) {
someloadpanel.sendextURL(this.orig_href); return false;
}

function showlinks(e) {
status = this.orig_href; return true ;
}

function hidelinks(e) {
status = '';
}

The third is that the rewritelinks function is modifying all links in
all Layers and I only want it to modify the links in the LoadPanel.

And last but not least....I have written a history extension to
LoadPanel.  Unfortunately the only way I could get this to work in IE5.5
is to include a DynAPI.document.releaseMouseEvents() (see below).
Should I be doing this, and if not how do I make it work for IE?  The
only reason I tried the releaseMouseEvents is that if you place an alert
before the setURL it works in IE.

LoadPanel.prototype.InitialiseHistory=function()  {
        this.history=new Array()
        this.historyLoc=-1
        this.historyLen=-1
        this.pnloc=1
        this.pnlen=1
        }

LoadPanel.prototype.UpdateHistory=function() {
        this.historyLoc+=this.pnloc;
        this.historyLen+=this.pnlen;
        this.history[this.historyLoc] = this.getURL();
        this.pnloc=1;
        this.pnlen=1;
        }
                
LoadPanel.prototype.Previous=function() {
        if (this.historyLoc>0) {
                this.pnloc=-1;
                this.pnlen=0;
                if (is.ie) { DynAPI.document.releaseMouseEvents(); }
                this.setURL(this.history[this.historyLoc-1]);
        }
}

LoadPanel.prototype.Next=function() {
        if (this.historyLoc<this.historyLen-1) {
                this.pnloc=1;
                this.pnlen=0;
                if (is.ie) { DynAPI.document.releaseMouseEvents(); }
                this.setURL(this.history[this.historyLoc+1]);
        }
}

I imagine the solutions to these problems are probably very simple but I
am still learning my way around DynAPI2 so if anyone could help me out I
would really appreciate it.

Cheers

Chris Williams
IT  Analyst - HRIT Asia Pacific, Cisco Systems (Australia) Pty Ltd.
_____________________________________________________
Phone: +61 2 8446 5020  Fax: +61 2 8446 8410
Mobile: 0402 896 764    E-mail: [EMAIL PROTECTED]


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to