|
-
Class for external links - warning alert
Hi,
in order to open a warning pop up when leaving page
I have this script:
function Warning() {
window.confirm
var answer = confirm("Wanna leave page?");
if (answer == true)
{
window.location= href;
}
else
{
return false;
}
}
I would like to call a function, with a specific class for all the external links.
function externalLinks() {
var anchors = document.getElementsByTagName('a');
for(var i=0; i<anchors.length;i++) {
if(anchors[i].className) {
if(anchors[i].href && anchors[i].className == "LinkedList") {
anchors[i].target = "_blank"; ;
}
}
}
}
How is it possible to get the class and open the popup?
(and yes I know that a warning popup is annoying... I´m told to do this)
-
What is the syntax for classname?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks