hi, everyone
i am new beginner in JavaScript environment
i have taken from internet image rollover script
but i dont understand some tricks in JavaScript
does anyone help me?
below is my code
Help with Code Tags (Toggle Plain Text)
<html>
<head>
<title>A More Effective Rollover</title>
<script>
window.onload = rolloverInit;
function rolloverInit() {
for (var i=0; i<document.images.length; i++) {
if (document.images[i].parentNode.tagName == "A") {
setupRollover(document.images[i]);
}
}
}
function setupRollover(thisImage) {
thisImage.outImage = new Image();
thisImage.outImage.src = thisImage.src;
thisImage.onmouseout = rollOut;
thisImage.overImage = new Image();
thisImage.overImage.src = "images/" + thisImage.id + "_on.gif";
thisImage.onmouseover = rollOver;
}
function rollOut() {
this.src = this.outImage.src;
}
function rollOver() {
this.src = this.overImage.src;
}
</script>
<style >
body {
background-color: white;
}
img {
border-width: 0;
}
</style>
</head>
<body>
<a href="next1.html"><img src="images/button1_off.gif" width="113" height="33" alt="button1" id="button1" /></a>
<a href="next2.html"><img src="images/button2_off.gif" width="113" height="33" alt="button2" id="button2" /></a>
</body>
</html>
here i dont understand this script and what does it means
Help with Code Tags (Toggle Plain Text)
for (var i=0; i<document.images.length; i++) {
if (document.images[i].parentNode.tagName == "A") {
setupRollover(document.images[i]);for (var i=0; i<document.images.length; i++) {
if (document.images[i].parentNode.tagName == "A") {
setupRollover(document.images[i]);
and I also dont understand for what reason here is used parentNode.tagName == "A" and what does it mean renaming it =="A"
thank you