javascript - Why does this code report an error?
ringa_lee
ringa_lee 2017-05-19 10:39:45
0
3
472
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>满天飞舞的雪花</title>
</head>
<body bgcolor="#000000">
<script language="javascript">
    var num = 15; 
    x = new Array(); 
    y = new Array();
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;

    for (i = 0; i < num; i++) {
        x[i] = Math.random()*(doc_width-30)+10; 
        y[i] = Math.random()*doc_height;
        str = "<img src='../assets/img/coupon_ico.png' style='position:absolute;";
        str += "top:" + y[i] + ";left:" + x[i] + "'id='dot" + i + "'>";
        document.write(str);
    }
    function snow(){
        for (i = 0; i < num; i++){
            x[i]+=Math.random()*3;
            x[i]-=Math.random()*3;
            y[i]++;
            if(y[i]>doc_height)y[i] = -20;
            document.all["dot"+i].style.pixelTop = y[i];
            document.all["dot"+i].style.pixelLeft = x[i];
        }
        setTimeout("snow()",10);
    }
    snow();
</script>
</body>
</html>

ringa_lee
ringa_lee

ringa_lee

reply all(3)
黄舟

The first TypeError is a code error in the installed browser plug-in. It has nothing to do with your code.

The second 404 error is that there is no favicon icon. Look at the top of the browser tab to see if there is one to the left of the title. This is the small icon of a website. It doesn’t matter if you write a test demo by yourself. How to specifically add the keyword you search for is probably to put the image in the same level directory or the root directory, and use the link tag to introduce it in the page

巴扎黑

The error reported is to get the value from undefined.
But the code you posted is not relevant.

洪涛

What does 'able' mean?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template