+ Reply to Thread
Results 1 to 4 of 4

Thread: [300 credits]Javascript

  1. #1
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    [300 credits]Javascript

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    <!--
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_findObj(n, d) { //v4.01
      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[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    
    var leftStart = -500;
    var leftEnd = 1400;
    
    var numberOfCounds = 5;
    var minSpeed = 1.0;
    var maxSpeed = 2.5;
    var y_variation = 90;
    var clouds_speed = new Array();
    var clouds_x_pos = new Array();
    
    
    function createClouds()
    {
        var cloudDiv = document.getElementById('cloudDiv');
    
        for (var idx=0; idx<numberOfCounds; idx++)
        {
            clouds_speed[idx] = (minSpeed + (Math.random()*(maxSpeed-minSpeed+1)));
            clouds_x_pos[idx] = Math.floor((Math.random()*(leftEnd-leftStart)) + leftStart);
    
            var y_pos = Math.floor((Math.random()*(y_variation+1)) - parseInt(y_variation/2));
    
            newCloud = document.createElement('img');
            newCloud.id = 'cloud_' + idx;
            newCloud.src = 'http://jagf.net/cloudfooter.png';
            newCloud.style.position = 'absolute';
            newCloud.style.top = y_pos + 'px';
            newCloud.style.left = clouds_x_pos[idx] + 'px';
            cloudDiv.appendChild(newCloud);
        }
        moveClouds();
    }
    
    function moveClouds()
    {
        for (var idx=0; idx<clouds_speed.length; idx++)
        {
            var cloud = document.getElementById('cloud_' + idx);
            var y_pos = parseInt(cloud.style.top);
    
            if (clouds_x_pos[idx]>leftEnd) {
                clouds_x_pos[idx] = leftStart;
                y_pos = Math.floor((Math.random()*(y_variation+1)) - parseInt(y_variation/2));
            }
            else
            {
                clouds_x_pos[idx] = clouds_x_pos[idx] + clouds_speed[idx];
            }
            cloud.style.left = Math.floor(clouds_x_pos[idx]);
            cloud.style.top = y_pos;
        }
    
        setTimeout(moveClouds, 30);
    
    }
    //-->
    </script>
    </head>
    
    <body onload="createClouds();">
    <center>
    <div id="wrap">
    <div id="header">
    <div id="cloudDiv" style="position:absolute;left:0px;top:0px;z-index:1;overflow:hidden;width:100%;height:220px;"></div>
    <div class="navigation">
    <a href="index.html">Home</a>&nbsp;&bull;&nbsp;<a href="order.html">Order</a>&nbsp;&bull;&nbsp;<a href="portfolio.html">Portfolio</a>
    </div> <!-- Navigation closed -->
    <div id="country">
     <a href="en/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('English','','images/us.png',1)" title="English"><img src="images/us1.png" alt="English" name="English" width="24" height="19" border="0" id="English" /></a><a href="se/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('swedish','','images/se.png',1)" title="Swedish"><img src="images/se1.png" alt="Swedish" name="swedish" width="24" height="19" border="0" id="swedish" /></a></div><!-- Country closed -->
    </div> <!-- Header closed -->
    lawl<br />
    lawl<br />
    lawl<br />
    lawl<br />
    lawl<br />
    
    <div id="footer">
    </div> <!-- Footer closed -->
    </div><!-- Wrap closed -->
    </center>
    </body>
    </html>
    For some reason, the clouds are messed up in FF, but works in IE.

    example: http://jagf.net/design/

  2. #2
    REBEL21's Avatar
    REBEL21 is offline x10 Lieutenant REBEL21 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    ireland
    Posts
    355

    Re: [300 credits]Javascript

    Tested it in an older firefox and it works fine im not sure but this code is perfectally fine, i just think that firefox doesnt like it! Looks good btw!
    Regards,
    Jamie
    Jamies Rebellion
    :thefingerJOIN DA REBELLION SWEEPING DA NATION:thefinger


  3. #3
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: [300 credits]Javascript

    But have you checked with FF 3.1?

  4. #4
    Thrash is offline x10Hosting Member Thrash is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    18

    Re: [300 credits]Javascript

    im using firefox 3.0.5 i think and it apears to be broken. i cant see anything wrong with the code but there probebly is.

+ Reply to Thread

Similar Threads

  1. [REQ] [1000 credits]Javascript help
    By galaxyAbstractor in forum The Marketplace
    Replies: 0
    Last Post: 12-22-2008, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers