我写了以下代码:
<script type='text/javascript'>
var imageID = 0;
function changeimage(every_seconds) {
//Change the image
if (!imageID) {
document.getElementById("myimage").src = "jesus.jpg";
imageID++;
} else { if(imageID==1) {
document.getElementById("myimage").src="crucifixion.jpg";
imageID++;
} else { if(imageID==2) {
document.getElementById("myimage").src="resurrection.jpg";
imageID++;
} else { if(imageID==3) {
document.getElementById("myimage").src="trinity.jpg";
imageID=0;
}}}}
//Call the same function again for x number of seconds
setTimeout("changeimage("+every_seconds+")",((every_seconds)*1000));
}
var k=0;
<!--[if gte IE, FF]><!-->
var k=1;
<!--><![endif]-->
function mytext1() {
if (k==1) {
document.getElementById("mylink").href="king.html";
document.getElementById("mytext").innerHTML="THE KING OF KINGS";
} else { if(k==2) {
document.getElementById("mylink").href="crucifixion.html";
document.getElementById("mytext").innerHTML="HE WAS PUNISHED FOR OUR SINS";
} else{ if(k==3) {
document.getElementById("mylink").href="resurrection.html";
document.getElementById("mytext").innerHTML="HE WON DEATH";
} else { if(k==4) {
document.getElementById("mylink").href="trinity.html";
document.getElementById("mytext").innerHTML="THE HOLY TRINITY";
k=0;
}}}}
k++;
}
</script>
要使程序在所有浏览器中运行,k 在 Chrome 中必须等于 1,在 Internet Explorer 和 Firefox 中必须等于 0。
如何隐藏K=1;
Internet Explorer 和 Firefox?