Team:Brown-Stanford/Templates/Main

From 2011.igem.org

(Difference between revisions)
Line 5: Line 5:
<script type="text/javascript">
<script type="text/javascript">
<!--  
<!--  
-
var rand = Math.round(Math.random() * (5)) + 1;
+
/* Script taken from leemessenger.co.uk - Please do not remove this line */
-
images = new Array
+
 
-
images[1] = "https://static.igem.org/mediawiki/2011/a/a1/Brown-Stanford_BG1.jpg"
+
function ChangeCSSBgImg() {
-
images[2] = "https://static.igem.org/mediawiki/2011/8/81/Brown-Stanford_BG2.jpg"
+
if (!document.getElementById) return false;
-
images[3] = "https://static.igem.org/mediawiki/2011/a/a9/Brown-Stanford_BG3.jpg"
+
 
-
images[4] = "https://static.igem.org/mediawiki/2011/f/fd/Brown-Stanford_BG4.jpg"
+
var MyElement = "#random" //The ID of the element you want to change
-
images[5] = "https://static.igem.org/mediawiki/2011/4/4c/Brown-Stanford_BG5.jpg"
+
var ImgPath = "" //The file path to your images
-
images[6] = "https://static.igem.org/mediawiki/2011/7/7f/Brown-Stanford_BG6.jpg"
+
 
-
var image = images[rand]
+
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>
-
<script type="text/javascript">
+
<body id="random">
-
<!--
+
-
document.write('<body style="background:background-image:url(\'' + image + '\'); background-repeat:no-repeat; background-attachment:fixed; background-position:center;">' + image)
+
-
-->
+
-
</script>
+
<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