Forum Moderators: open
<a href="http://www.mozilla.org/" onclick="return OffSite(this);" title="Mozilla">mozilla.org</a>
function OffSite(What) {
// <a href="http://..." onclick="return OffSite(this);">...</a>
// <form ... onsubmit="return OffSite(this);...">
// button onclick="OffSite(this);..."
var OS_href, OS_action, OS_onclick, OS_Message, OS_Confirm;
OS_href=What['href'];
OS_action=What['action'];
OS_onclick=What['onclick'];
if ((OS_href)
&& (OS_href != '')
&& (OS_href != 'undefined')) { // an "a" tag
if (OS_href.substring(0,4) == 'http') { // only the non-404's
What.target='_blank';
OS_Message ='';
OS_Message+='You are now leaving my site; thank you for ';
OS_Message+='visiting. The target site may open in ';
OS_Message+='a new window; please close it when you wish ';
OS_Message+='to return. ';
OS_Confirm=confirm(OS_Message);
return OS_Confirm;
}
return true;
} // end of "a" tag
if ((OS_action)
&& (OS_action != '')
&& (OS_action != 'undefined')) { // a "form" tag
What.target='_blank';
OS_Message ='';
OS_Message+='This form links to a program outside of my ';
OS_Message+='site. It may open it\'s results in a new ';
OS_Message+='window; please close it when you wish to ';
OS_Message+='return. ';
OS_Confirm=confirm(OS_Message);
return OS_Confirm;
} // end of "form" tag
if ((OS_onclick)
&& (OS_onclick != '')
&& (OS_onclick != 'undefined')) { // an "onclick" button
OS_Message ='';
OS_Message+='This button links to a program outside of my ';
OS_Message+='site. It may open in a new window; please ';
OS_Message+='close it when you wish to return. ';
OS_Confirm=confirm(OS_Message);
return OS_Confirm;
} // end of "onclick" button
return true;
} // OffSite