Subject: Here is the function I think I should update…
function GoTo(){// This is where the link is created…
if(this.LinkTxt){
status='';
var HP=Nav4?this.LowLyr:this;
LowItem(HP);
var MemVal=eval(WhatMenu+'[0]');
if(MemVal=="Home"){
DcLoc=????????????????
}
this.LinkTxt.indexOf('javascript:')!=-1?eval(this.LinkTxt):DcLoc.location.href=this.LinkTxt
}
}
The “DcLoc” variable is the frame…
I check to see if the first occurrence in the array I pass is set to “Home.” Then I create the link…
How would I change it correctly to reflect the “_top” target???
parent.frames[‘_top’]???
parent.frames[‘_new’]???
Since I am using a frame called “BodyFrame” as the target for all links in this menu, for the “Home” link I want to appear correctly - not inside the BodyFrame…
That which JavaScript writes in the client is not a part of the source, so “view source” will not help. You can examine the in-memory document to your heart’s content using JavaScript. How’s your DOM-parsing skills?
That should be easy enough. You can get a collection of all of the HTML-based links on a document using document.links, then you can look through them individually for some other characteristic:
function setLinkTargets() {
var links = document.links;
for (i=0;i<links.length;i++) {
if (links[i].href) {
if (links[i].href.indexOf(‘http’) {
// if the target cannot be directly set to new
if (!(links[i].target=‘_new’) {
//create a target attribute node for the link
var tartgetNode = document.createAttribute(‘target’);
//set the value of the target
targetNode.value = ‘_new’;
//actually put the attribute in the link
links[i].setAttribute(targetNode);
}
}
}
}
}
Some older browsers will upchuck and die if they come across DOM methods, so we’ll try to set the target attribute directly first. Newer browsers won’t let you set the target unless it already exists as an attribute node, so we’ve got code in the to create and set the target node if necessary.
Subject: RE: Where is optimal place to put this code???
Unless otherwise specified, JavaScript belongs in a .js file. As for the .links property, it should grab everything, even in Netscape 4. If I remember correctly, it was one of the few collections that didn’t need to go through a layers hierarchy. Apart from Netscape 4, all browsers let you address collections “flat”; .links contains all links, .images contains all images, and so forth. In up-to-date browsers, you can even use document.getElementsByTagName(‘a’) to get all of the link nodes.
Subject: Does “document.links” property find links in layers???
I am trying to find all links in a document on the web using the following function from a ND6 forum post that I customized :1. function setLinkTargets() {
var targetNode = links[i].createAttribute(‘target’);
//set the value of the target
targetNode.value = ‘_new’;
alert(“In setLinkTargets…New links[”+ i +"].href: " + links[i].href);
alert(“In setLinkTargets…New links[”+ i +"].target: " + links[i].target);
}
}
}
}
}
I place this in the JSHeader of the form and call “setLinkTargets()” from the “onLoad” event. I have also placed in a “.js” file loaded in a subform and made the call from the onLoad event of the form.
However, it only finds the links in the document, not in the layer. I tested this by creating a button with the call “setLinkTargets()” - placed some alert statements and saw the links. I am assuming that once the form is loaded all links are loaded, even in the layer(s). I press the button once the form is loaded.
Line 19 throws an “Object doesn’t support this property or method” error.
I know that is a DOM method. I am using IE 6 for testing right now.
HiI have a similar problem. When my url contains target=“_blank” it tries to open it in Notes window itself. The link contains another web application url which is sent to notes through email. If this url is opened in Notes e-mail, it generates error as it is opened in Notes itself.
It works for my friends: The url opens up in Internet Explorer (set as default browser in Notes settings).
Please tell me what settings need to be changed in Notes so that ,my url opens in Web browser?