.comment-link {margin-left:.6em;}

kHSw

Tuesday, September 14, 2004

Base Target and Javascript

In our current project we our using some Sharepoint-components on our webpages. If we have to incorporate another website in our website, we use frames.
But all the links in the Sharepoint components had to point to _top because otherwise they just opened in the upper frame.
<base target="_top"> caused problems with some links because they pointed to a Javascript-function. With the base target set, the browser looked for the specification of the function in the target defined.

So we wrote a little script that sets the target property for all links not pointing to a Javascript function.


<script language="Javascript">
for (var i=0;i<window.document.links.length;i++) {
if (window.document.links[i].href.substr(0,11).toLowerCase() != "javascript:") {
window.document.links[i].target = "_top";
}
}
</script>



0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home


 
Stefanie Worm is het liefste vrouwtje van de wereld.
Melina is de liefste schatsie van de wereld (Erik De Maeyer).