Team:Brown-Stanford/Templates/Main
From 2011.igem.org
(Difference between revisions)
Line 5: | Line 5: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
<!-- | <!-- | ||
- | + | /* Script taken from leemessenger.co.uk - Please do not remove this line */ | |
- | + | ||
- | + | function ChangeCSSBgImg() { | |
- | + | if (!document.getElementById) return false; | |
- | + | ||
- | + | var MyElement = "#random" //The ID of the element you want to change | |
- | + | var ImgPath = "" //The file path to your images | |
- | + | ||
- | var | + | if (!document.getElementById(MyElement)) return false; |
+ | |||
+ | var random_images = new Array (); | ||
+ | random_images[0] = "https://static.igem.org/mediawiki/2011/a/a1/Brown-Stanford_BG1.jpg" | ||
+ | random_images[1] = "https://static.igem.org/mediawiki/2011/8/81/Brown-Stanford_BG2.jpg" | ||
+ | random_images[2] = "https://static.igem.org/mediawiki/2011/a/a9/Brown-Stanford_BG3.jpg" | ||
+ | random_images[3] = "https://static.igem.org/mediawiki/2011/f/fd/Brown-Stanford_BG4.jpg" | ||
+ | random_images[4] = "https://static.igem.org/mediawiki/2011/4/4c/Brown-Stanford_BG5.jpg" | ||
+ | random_images[5] = "https://static.igem.org/mediawiki/2011/7/7f/Brown-Stanford_BG6.jpg" | ||
+ | |||
+ | var $header = document.getElementById(MyElement); | ||
+ | var $backgroundurl = $header.style.backgroundImage; | ||
+ | var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")"; | ||
+ | |||
+ | if ($backgroundurl != ImgURL) { | ||
+ | $header.style.backgroundImage = ImgURL; | ||
+ | } | ||
+ | |||
+ | movement = setTimeout("ChangeCSSBgImg()",14000); | ||
+ | } | ||
+ | |||
+ | /* random number generator */ | ||
+ | function rand(n) { | ||
+ | return ( Math.floor ( Math.random ( ) * n ) ); | ||
+ | } | ||
+ | |||
+ | /* Custom onload function */ | ||
+ | |||
+ | function addLoadEvent(func) { | ||
+ | var oldonload = window.onload; | ||
+ | if (typeof window.onload != 'function') { | ||
+ | window.onload = func; | ||
+ | } else { | ||
+ | window.onload = function() { | ||
+ | oldonload(); | ||
+ | func(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* trigger onload */ | ||
+ | |||
+ | addLoadEvent(ChangeCSSBgImg); | ||
--> | --> | ||
</script> | </script> | ||
Line 548: | Line 590: | ||
<link rel="stylesheet" type="text/css" href="https://2011.igem.org/Team:Brown-Stanford/css?action=raw&ctype=text/css" /> | <link rel="stylesheet" type="text/css" href="https://2011.igem.org/Team:Brown-Stanford/css?action=raw&ctype=text/css" /> | ||
</head> | </head> | ||
- | + | <body id="random"> | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
<div id="wrap"> | <div id="wrap"> | ||
<div id="header" style="height:100px;padding: 85px 55px 10px 55px"><!--<img align="center" style="margin-bottom:0px; padding:0;" src="https://static.igem.org/mediawiki/2010/d/d4/CamBillHeaderSq.png" usemap="#headermap" alt="E. glowli">--> | <div id="header" style="height:100px;padding: 85px 55px 10px 55px"><!--<img align="center" style="margin-bottom:0px; padding:0;" src="https://static.igem.org/mediawiki/2010/d/d4/CamBillHeaderSq.png" usemap="#headermap" alt="E. glowli">--> |
Revision as of 21:59, 9 June 2011