| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 495 人关注过本帖
标题:一个代码问题急需解决!!
取消只看楼主 加入收藏
许愿池的少女
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-8-23
收藏
 问题点数:0 回复次数:0 
一个代码问题急需解决!!

谢谢大家了,希望能尽快帮我解决!

[em03
问题是这样的:
我的网页首页面上,左右两边各有一条空白,这两条空白都在body之外,也就是说在head
里边!
左侧空白处飘浮着一个图片,是上下浮动的。代码如下
<DIV id=img
style="Z-INDEX: 2; left: 1px; WIDTH: 119px; POSITION: absolute; TOP: 400px; HEIGHT: 106px"><a href="#"
onClick="javascript:window.open('http://www.mianfeitong.com/c2c_cn_new.asp?user=vanmaat118','免费通
话','resizable=0,width=510,height=410')"><img src="http://www.3klp.com/zhaos/images/call02.jpg" alt=免费通 width=100
height="142" border=0></a>
</DIV>
<SCRIPT language=JavaScript><!-- Begin
var step = 1;
var delay = 30;
var height = 1;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
var name = navigator.appName;
if(name == "Microsoft Internet Explorer") name = true;
else name = false;
var xPos = 20;
if(name) var yPos = document.body.clientHeight;
else var yPos = window.innerHeight;
function changePos() {
if(name) {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.top = yPos + document.body.scrollTop;
}
else {
height = window.innerHeight;
width = window.innerWidth;
Hoffset = document.img.clip.height;
Woffset = document.img.clip.width;
document.img.pageY = yPos + window.pageYOffset;
document.img.pageX = xPos + window.pageXOffset;
}
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() {
if(name) img.visibility = "visible";
else document.img.visibility = "visible";
interval = setInterval('changePos()',delay);
}
function pauseResume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
// End -->
</SCRIPT>
现有我有一张图片,我想让它在右侧浮动,和左侧的一样,也是上下浮动。只是这个图片没有链接,
左侧的图片有链接。我把代码改成如下所示,可是上传之后,右侧的图片浮动,左侧图片不动了,
我想让你看看是哪儿错了!
希望你尽快给我答复!谢谢了!
右侧图片代码如下:
<DIV id=imgr
style="Z-INDEX: 2; right: 10px; WIDTH: 119px; POSITION: absolute; TOP: 400px; HEIGHT: 106px">
<img src="images/right.jpg" width=100 height="500" border=0>
</DIV>
<SCRIPT language=JavaScript><!-- Begin
var step = 1;
var delay = 30;
var height = 1;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
var name = navigator.appName;
if(name == "Microsoft Internet Explorer") name = true;
else name = false;
var xPos = 20;
if(name) var yPos = document.body.clientHeight;
else var yPos = window.innerHeight;
function changePos() {
if(name) {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = imgr.offsetHeight;
Woffset = imgr.offsetWidth;
imgr.style.top = yPos + document.body.scrollTop;
}
else {
height = window.innerHeight;
width = window.innerWidth;
Hoffset = document.imgr.clip.height;
Woffset = document.imgr.clip.width;
document.imgr.pageY = yPos + window.pageYOffset;
document.imgr.pageX = xPos + window.pageXOffset;
}
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() {
if(name) imgr.visibility = "visible";
else document.imgr.visibility = "visible";
interval = setInterval('changePos()',delay);
}
function pauseResume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
// End -->
</SCRIPT>
2006-08-23 10:06
快速回复:一个代码问题急需解决!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024921 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved