Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });
Overall, this is what you should have:
var ourdomainname = "ourdomain.com";
function linkallthelinks(domain) {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute("href");
if (href.indexOf('read_today') != -1) {
link.setAttribute('onclick', function(){ alert'alert("Okay") }');
}
}
}
//function call
linkallthelinks(ourdomainname);
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });
Overall, this is what you should have:
var ourdomainname = "ourdomain.com";
function linkallthelinks(domain) {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute("href");
if (href.indexOf('read_today') != -1) {
link.setAttribute('onclick', function(){ alert("Okay") });
}
}
}
//function call
linkallthelinks(ourdomainname);
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Overall, this is what you should have:
var ourdomainname = "ourdomain.com";
function linkallthelinks(domain) {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute("href");
if (href.indexOf('read_today') != -1) {
link.setAttribute('onclick', 'alert("Okay")');
}
}
}
//function call
linkallthelinks(ourdomainname);
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });
Overall, this is what you should have:
var ourdomainname = "ourdomain.com";
function linkallthelinks(domain) {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute("href");
if (href.indexOf('read_today') != -1) {
link.setAttribute('onclick', function(){ alert("Okay") });
}
}
}
//function call
linkallthelinks(ourdomainname);
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });
Overall, this is what you should have:
var ourdomainname = "ourdomain.com";
function linkallthelinks(domain) {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute("href");
if (href.indexOf('read_today') != -1) {
link.setAttribute('onclick', function(){ alert("Okay") });
}
}
}
//function call
linkallthelinks(ourdomainname);
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', 'functionfunction(){ alert("Okay") }');
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', 'function(){ alert("Okay") }');
Missing quotes here:
if(href.indexOf(read_today) != -1)
Should be:
if(href.indexOf('read_today') != -1)
Also change:
link.setAttribute('onclick', 'alert("Okay")');
To:
link.setAttribute('onclick', function(){ alert("Okay") });