Помогите пожалуйста исправить программу

Discussion in 'PHP' started by Alenochka, 14 Dec 2011.

  1. Alenochka

    Alenochka New Member

    Joined:
    13 Dec 2011
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    Дали задание,исправить программу,а не могу сообразить где,что менять.
    Нужно Изменить движение окна на слева-направо, сверху-вниз, справа - налево и т.д.

    картинка и код программы должны быть в 1 файле.открывать через эксплорер,выскочить разблокировать содержимое-нажмите разрешить.

    вот код:


    <html>

    <head>

    <title>....Просмотр java-скрипта....</title>
    <STYLE TYPE="text/css">
    <!--
    A { font-family: Arial,Helvetica,sans-serif; color: #0000FF;text-decoration:underline}
    A:visited { font-family: Arial,Helvetica,sans-serif; color: #0000FF}
    A:hover { font-family: Arial,Helvetica,sans-serif; color: #0000FF}
    -->
    </STYLE>

    <script>
    <!--

    var x,y
    var marginbottom
    var marginleft=0
    var margintop=0
    var marginright

    var cliptop
    var clipbottom
    var clipleft
    var clipright
    var clippoints

    var ballheight=100
    var ballwidth=100

    var imageheight=550
    var imagewidth=500


    // less is faster
    var tempo=60

    // horizontal move (pixels) within time unit
    var stepx=100

    // vertical move (pixels) within time unit
    var stepy=6
    var timer


    // check the width and the height of the document
    // gets the starting position of the ball by random
    function setValues() {
    if (document.all) {
    marginbottom = imageheight-ballheight
    marginright = imagewidth-ballwidth
    document.all.ball.style.posLeft=randommaker(400)
    document.all.ball.style.posTop=0
    document.all.textcontent.style.posLeft=0
    document.all.textcontent.style.posTop=0
    document.all.ball.style.filter="alpha(opacity=0,fi nishopacity=100,style=2,startX=0px,startY=0px,fini shX=100px,finishY=100px)"
    moveball()
    }
    }

    // randomfunction
    function randommaker(range) {
    rand=Math.floor(range*Math.random())
    return rand
    }

    function moveball() {
    checkposition()
    if (document.all) {
    document.all.ball.style.posLeft+=stepx
    document.all.ball.style.posTop+=stepy

    cliptop=document.all.ball.style.posTop
    clipbottom=cliptop+ballheight
    clipleft=document.all.ball.style.posLeft
    clipright=clipleft+ballwidth

    clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
    document.all.textcontent.style.clip=clippoints
    timer=setTimeout("moveball()",tempo)
    }
    }

    function checkposition() {
    if (document.all) {
    if (document.all.ball.style.posLeft>=marginright) {
    stepx=stepx*-1
    document.all.ball.style.posLeft-=10
    }
    if (document.all.ball.style.posLeft<=marginleft) {
    stepx=stepx*-1
    document.all.ball.style.posLeft+=10
    }
    if (document.all.ball.style.posTop>=marginbottom) {
    stepy=stepy*-1
    document.all.ball.style.posTop-=10
    }
    if (document.all.ball.style.posTop<=margintop) {
    stepy=stepy*-1
    document.all.ball.style.posTop+=10
    }
    }
    }
    // - End of JavaScript - -->
    </script>


    </head>

    <body bgColor=#eee1bc link="#008000" onLoad="setValues()">

    <p align="center">



    <p></p>
    <DIV id="textcontent" style="position: absolute; top:-5000px; left:-5000px"><img src="zeta0212.gif" border="0"></DIV>

    <DIV id="ball" style="position:absolute; top:-50px; width:100px;height:100px;background-color:weat;"></DIV>

    <P><FONT size=1>
    <SCRIPT
    language=JavaScript><!--
    function closeIt() {
    close();
    }
    // -->
    </SCRIPT>
    </FONT></P>


    <FONT size=1><FORM>
    <p align="center"><INPUT onclick=closeIt() type=button value=Закрыть!>
    </FORM></FONT>


    </body>

    </html>

    и вот картинка: http://depositfiles.com/files/nl7qn0ehp
     
  2. barnaki

    barnaki Elder - Старейшина

    Joined:
    2 Nov 2008
    Messages:
    676
    Likes Received:
    130
    Reputations:
    4
    хоть опиши нормально что надо сделать. и как сейчас. или думаешь кому то хочется твой js читать и догадыватся . и вообще голый js прошлый век. посмотри библиотеки jquery,prototype и тд.
    ps. а вообще жесть у тебя кодик. хорошо что хоть на англ.
     
    #2 barnaki, 15 Dec 2011
    Last edited: 18 Dec 2011