Check the following code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
</style>
<script type="text/javascript">
function getLastMod(){
var myFrm = window.frames['myiframe'];
var lm = new Date(myFrm.document.lastModified);
var dt = lm.getDate();
var mm = lm.getMonth() + 1;
var yy = lm.getFullYear();
var lmDate = mm + "-" + dt + "-" + yy;
//Based on the innerHTML
document.getElementById('LastModified').innerHTML = "<a href='your_destination_page.htm'>Prices correct as at: " + lmDate; + "</a>";
//DOM based method
/*var aEl = document.createElement('a');
aEl.href = 'your_destination_page.htm';
aEl.appendChild(document.createTextNode('Prices correct as at: ' + lmDate));
document.getElementById('LastModified').appendChild(aEl);*/
}
</script>
</head>
<body>
<span id="LastModified"></span>
<iframe id="myIframe" name="myiframe" onload="getLastMod();" src="prices.txt" style="display:none;">
</iframe>
</body>
</html>
In the above mentioned code I have two method for doing the same job (inserting the hyperlinks):
1. Using innerHTML
2. Using DOM
The above code comments the DOM based method. if you want you can uncomment the code that comes under the DOM method. Make sure to comment the innerHTML based code otherwise you'll get two links in the span element. Also make sure that you do mention a correct destination page in anchor element..
I've highlighted all the portion, which I've changed.
Works well in IE and FF. Though I don't know what exactly you are trying to do.
Hope this helps.
Bookmarks