| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1814 人关注过本帖
标题:求助帖:急!!请哪位大神帮我看看这段泡泡效果JS
取消只看楼主 加入收藏
xiaohuaddf
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-16
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
求助帖:急!!请哪位大神帮我看看这段泡泡效果JS
要实现气泡往上冒的效果,问题在于,只要加上网页最前端的声明<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.后,泡泡就停在网页左上角不动了。去除这句声明,泡泡就可以正常运动。
请哪位大神帮我看看这段JS代码要怎么改,才能在正常情况下起作用啊,跪谢!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效|飞舞的泡泡</title>
</head>

<body>


<SCRIPT language=JavaScript>
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) {
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) {
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

</SCRIPT>
<SCRIPT language=JavaScript>
var url = "#"
var no = 3;
var speed = 20;
var snow = new Array();
snow[0] = "../images/pao_006699.gif"
snow[1] = "../images/pao_6699cc.gif"
snow[2] = "../images/pao_99ccff.gif"
snow[3] = "../images/pao_3366ff.gif"
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 100, doc_height = 1800;

if (ns4up||ns6up) {
        doc_width = 100;
        doc_height = self.innerHeight;
} else if (ie4up) {
        doc_width = 100;
        doc_height = document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
j = 0;
for (i = 0; i < no; ++ i) {
        dx = 0;
        xp = Math.random()*50;
        yp = Math.random()*doc_height;
        am = Math.random()*20;
        stx = 0.02 + Math.random()/10;
        sty = 0.7 + Math.random();

tag=j+1;
        if (ns4up) {
                        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\" z-index=\""+ i + "\">" +
"<a href=http://sfgsgsdfg target=\"_blank\" onMouseOver=\"MM_showHideLayers('tag" +i +"','','show')\" onMouseOut=\"MM_showHideLayers('tag" + i + "','','hide')\">" +
"<img src=\""+ snow[j] + "\" border=\"0\"></a>" +
                                                                                                                        
                                                "</layer></layer>");
                                                }
                                                
                else if (ie4up||ns6up) {
                        document.write(
                                                "<div id=\"dot"+ i +"\" style=\"OSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\">" +
"<a href=http://sfgsgsdfg target=\"_blank\" onMouseOver=\"MM_showHideLayers('tag" +i +"','','show')\" onMouseOut=\"MM_showHideLayers('tag" + i + "','','hide')\">" +
"<img src=\"" + snow[j] + "\" border=\"0\"></a>" +

                                                "</div></div>");
        }
        if (j == (snow.length-1)) { j = 0; } else { j += 1; }
}

function snowNS() {
        for (i = 0; i < no; ++ i) {
                yp -= sty;                if (yp < -50) {
                        xp = Math.random()*(doc_width-am-30);
                        yp = doc_height;
                        stx = 0.02 + Math.random()/10;
                        sty = 0.7 + Math.random();
                        doc_width = 100;
                        doc_height = self.innerHeight;                }
                dx += stx;
                document.layers["dot"+i].top = yp;
                document.layers["dot"+i].left = xp +
am*Math.sin(dx);
        }
        setTimeout("snowNS()", speed);
}

function snowIE_NS6() {
        for (i = 0; i < no; ++ i) {
                yp -= sty;
                if (yp < -50) {
                        xp = Math.random()*(doc_width-am-30);
                        yp = doc_height;
                        stx = 0.02 + Math.random()/10;
                        sty = 0.7 + Math.random();
                        doc_width = ns6up?100:100;
                        doc_height = ns6up?window.innerHeight-5:document.body.clientHeight;
                }
                dx += stx;
                if (ie4up){
                document.all["dot"+i].style.pixelTop = yp;
                document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);
                }
                else if (ns6up){
                document.getElementById("dot"+i).style.top=yp;
                document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx);
                }
        }
        setTimeout("snowIE_NS6()", speed);
}
if (ns4up) {
        snowNS();
} else if (ie4up||ns6up) {
        snowIE_NS6();
}
</SCRIPT>
</body>

</html>
搜索更多相关主题的帖子: content PUBLIC title 网页 
2015-06-16 18:42
xiaohuaddf
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-16
收藏
得分:0 
回复 2楼 边小白
没有泡泡是因为我没上传图片文件哦,随便搞个图片,写好路径,就可以看到图片是从下往上冒的啦,问题关键在于这段JS和声明有冲突,有没有高手帮忙解决一下啊,谢谢啦
2015-06-17 10:57
xiaohuaddf
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-16
收藏
得分:0 
回复 4楼 jsRank
啊,太感谢了,按你的方法问题真的解决啦,看来你对前端很精通啊,赞!!!
2015-06-17 12:55
快速回复:求助帖:急!!请哪位大神帮我看看这段泡泡效果JS
数据加载中...
 
   



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

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