Can someone please help me with this JavaScript?
The link-color does effect other links too.
I have little or no knowledge of programming. After a lot of searching and experimenting, this is how far I've come. Some parts of this script are confusing, and I would appreciate it very much if anyone could help me out.
This is the script that I've tried to put together. The uploaded file is a test-page that shows the script in action.
emName = 'post'
emDomain = 'example.com'
emLink = 'Send An Email'
var em = (emName + String.fromCharCode(32 * 2) + emDomain)
document.write('<a href="mailto:' + em + '?subject=Hello there! :-)">' + emLink + '<\/a>')
var emLink = document.getElementById("myemail");
emLink.style.fontFamily = 'calibri';
emLink.style.fontSize = '25px';
emLink.style.fontWeight = '700';
emLink.style.lineHeight = '1,4';
emLink.style.textDecoration = 'underline';
colourLink("#e34c19");
function colourLink(hex) {
var link = document.getElementsByTagName("a");
for (var i=0; i<link.length; i++) {
if (link[i].href) {
link[i].style.color = hex;
}
}
}
</script></span>
Kjersti