我找的飘窗js代码为什么在360、火狐这些浏览器里面没有效果,ie里面确可以呢,兼容性的问题吗?

JavaScript03

我找的飘窗js代码为什么在360、火狐这些浏览器里面没有效果,ie里面确可以呢,兼容性的问题吗?,第1张

尊敬的用户,您好!很高兴为您答疑

你的代码有如下问题:

1、document.all这个属性本身是IE的特有属性,且不符合W3c标准,所以除了IE之外,chrome和firefox都不支持。 2、document.documentElement.clientWidth/document.documentElement.clientHeight/document.documentElement.scrollLeft/document.documentElement.scrollTop这几个属性在不同内核的浏览器下存在兼容问题,不推荐使用.

希望我的回答对您有所帮助,如有疑问,欢迎继续咨询我们。

<html>

<head>

<title>html-WEB开发</title>

</head>

<body>

<div id="img" style="position:absolutez-index=99">

<img src="http://www.alixixi.com/images/face/image21.gif" onClick="pause_resume()" border="0" alt='img' onload="return imgzoom(this,600)" onclick="javascript:window.open(this.src)" style="cursor:pointer"/>

</div>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var xPos = document.body.clientWidth-20

var yPos = document.body.clientHeight/2

var step = 1

var delay = 5

var height = 0

var Hoffset = 0

var Woffset = 0

var yon = 0

var xon = 0

var pause = true

var interval

img.style.top = yPos

function changePos() {

width = document.body.clientWidth

height = document.body.clientHeight

Hoffset = img.offsetHeight

Woffset = img.offsetWidth

img.style.left = xPos + document.body.scrollLeft

img.style.top = yPos + document.body.scrollTop

if (yon) {

yPos = yPos + step

}else {

yPos = yPos - step

}

if (yPos <0) {

yon = 1

yPos = 0

}

if (yPos >= (height - Hoffset)) {

yon = 0

yPos = (height - Hoffset)

}

if (xon) {

xPos = xPos + step

}else {

xPos = xPos - step

}

if (xPos <0) {

xon = 1

xPos = 0

}

if (xPos >= (width - Woffset)) {

xon = 0

xPos = (width - Woffset)

}

}

function start() {

img.visibility = "visible"

interval = setInterval('changePos()', delay)

}

function pause_resume() {

if(pause) {

clearInterval(interval)

pause = false

}else {

interval = setInterval('changePos()',delay)

pause = true

}

}

start()

// End -->

</script>

</body>

</html>

写法如下:

<?php include("footer.html")?>

这句命令所在的文件扩展名必须被为.php。

除了引用本服务器上的文件,PHP的include命令还可以用来引用其它网站上的html文件,比如:

<?php include(http://www.prglab.com/examples/footer.html)?>

当然你要得到其它网站的允许才能引用别人的文件。