پرواز یک متن در وبلاگ
<STYLE type=text/css>#supertext { LEFT: 0px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden } </STYLE> <script language="JavaScript1.2"> var thecontent='<h2><font color="#0000FF">Welcome to my weblog!</font></h2>' var hidetimer=''; var BallSpeed = 5; var contentWidth; var contentHeight; var maxBallSpeed = 50; var xMax; var yMax; var xPos = 0; var yPos = 0; var xDir = 'right'; var yDir = 'down'; var superballRunning = true; var tempBallSpeed; var currentBallSrc; var newXDir; var newYDir; function initializeBall() { if (document.all) { xMax = document.body.clientWidth yMax = document.body.clientHeight document.all("supertext").style.visibility = "visible"; contentWidth=supertext.offsetWidth contentHeight=supertext.offsetHeight } else if (document.layers) { xMax = window.innerWidth; yMax = window.innerHeight; contentWidth=document.supertext.document.width contentHeight=document.supertext.document.height document.layers["supertext"].visibility = "show"; } setTimeout('moveBall()',400); if (hidetimer!='') setTimeout("hidetext()",hidetimer) } function moveBall() { if (superballRunning == true) { calculatePosition(); if (document.all) { document.all("supertext").style.left = xPos + document.body.scrollLeft; document.all("supertext").style.top = yPos + document.body.scrollTop; } else if (document.layers) { document.layers["supertext"].left = xPos + pageXOffset; document.layers["supertext"].top = yPos + pageYOffset; } animatetext=setTimeout('moveBall()',20); } } function calculatePosition() { if (xDir == "right") { if (xPos > (xMax - contentWidth - BallSpeed)) { xDir = "left"; } } else if (xDir == "left") { if (xPos < (0 + BallSpeed)) { xDir = "right"; } } if (yDir == "down") { if (yPos > (yMax - contentHeight - BallSpeed)) { yDir = "up"; } } else if (yDir == "up") { if (yPos < (0 + BallSpeed)) { yDir = "down"; } } if (xDir == "right") { xPos = xPos + BallSpeed; } else if (xDir == "left") { xPos = xPos - BallSpeed; } else { xPos = xPos; } if (yDir == "down") { yPos = yPos + BallSpeed; } else if (yDir == "up") { yPos = yPos - BallSpeed; } else { yPos = yPos; } } function hidetext(){ if (document.all) supertext.style.visibility="hidden" else if (document.layers) document.supertext.visibility="hide" clearTimeout(animatetext) } if (document.all||document.layers){ document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>') window.onload = initializeBall; window.onresize = new Function("window.location.reload()"); } </script></body> </html>
ریزش باران در وبلاگ
<meta http-equiv="Content-Language" content="en-us"> <body> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var no = 50; var speed = 2; var ns4up = (document.layers) ? 1 : 0; var ie4up = (document.all) ? 1 : 0; var s, x, y, sn, cs; var a, r, cx, cy; var i, doc_width = 800, doc_height = 600; if (ns4up) { doc_width = self.innerWidth; doc_height = self.innerHeight; } else if (ie4up) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } x = new Array(); y = new Array(); r = new Array(); cx = new Array(); cy = new Array(); s = 8; for (i = 0; i < no; ++ i) { initRain(); if (ns4up) { if (i == 0) { document.write("<layer name="dot"+ i +"" left="1" "); document.write("top="1" visibility="show"><font color="blue">"); document.write(",</font></layer>"); } else { document.write("<layer name="dot"+ i +"" left="1" "); document.write("top="1" visibility="show"><font color="blue">"); document.write(",</font></layer>"); } } else if (ie4up) { if (i == 0) { document.write("<div id="dot"+ i +"" style="POSITION: "); document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: "); document.write("visible; TOP: 15px; LEFT: 15px;"><font color="blue">"); document.write(",</font></div>"); } else { document.write("<div id="dot"+ i +"" style="POSITION: "); document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: "); document.write("visible; TOP: 15px; LEFT: 15px;"><font color="blue">"); document.write(",</font></div>"); } } } function initRain() { a = 6; r[i] = 1; sn = Math.sin(a); cs = Math.cos(a); cx[i] = Math.random() * doc_width + 1; cy[i] = Math.random() * doc_height + 1; x[i] = r[i] * sn + cx[i]; y[i] = cy[i]; } function makeRain() { r[i] = 1; cx[i] = Math.random() * doc_width + 1; cy[i] = 1; x[i] = r[i] * sn + cx[i]; y[i] = r[i] * cs + cy[i]; } function updateRain() { r[i] += s; x[i] = r[i] * sn + cx[i]; y[i] = r[i] * cs + cy[i]; } function raindropNS() { for (i = 0; i < no; ++ i) { updateRain(); if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) { makeRain(); doc_width = self.innerWidth; doc_height = self.innerHeight; } document.layers["dot"+i].top = y[i]; document.layers["dot"+i].left = x[i]; } setTimeout("raindropNS()", speed); } function raindropIE() { for (i = 0; i < no; ++ i) { updateRain(); if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) { makeRain(); doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } document.all["dot"+i].style.pixelTop = y[i]; document.all["dot"+i].style.pixelLeft = x[i]; } setTimeout("raindropIE()", speed); } if (ns4up) { raindropNS(); } else if (ie4up) { raindropIE(); } // End --> </script> <!-- Script Size: 3.14 KB -->
دریافت نام کاربر و خوش امد گویی
<HEAD> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <SCRIPT LANGUAGE="Javascript"> var namePrompt = prompt("ببخشید اسم شریفتون؟",""); function dispname (namePrompt) { document.write(""+namePrompt+""); } </SCRIPT> <BODY> <CENTER> <SCRIPT LANGUAGE="Javascript"> document.write("<font size=3 color=red> خوش امدی عزیزم, "); dispname(namePrompt); document.write("!</font>"); </SCRIPT> </CENTER></body> </html> </body> </html>
این وبلاگ را صفحه خانگی خود کنید
<font face="Tahoma" size="2"><A href="javascript:history.go(0)" onClick="javascript:this.style.behavior='url(#default#homepage)';this.setHomePage ('http://www.iransohrab.net');" TARGET="_self">این وبلاگ را صفحه خانگی خود کنید</A></font></body></html>
افکت مربوط به انتخاب رنگ زمینه صفحه وبلاگ شما
<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function backcolor(form) { temp = "" for (var i = 0; i < 16; i++) { temp = form.color[i].value if (form.color[i].checked){ document.bgColor = temp } } } function randombackground() { document.bgColor = getColor() } function getColor(){ currentdate = new Date() backgroundcolor = currentdate.getSeconds() if (backgroundcolor > 44) backgroundcolor = backgroundcolor - 45 else if (backgroundcolor > 29) backgroundcolor = backgroundcolor - 30 else if (backgroundcolor > 15) backgroundcolor = backgroundcolor - 16 if (backgroundcolor == 0 ) return "olive"; else if (backgroundcolor == 1 ) return "teal"; else if (backgroundcolor == 2 ) return "red"; else if (backgroundcolor == 3 ) return "blue"; else if (backgroundcolor == 4 ) return "maroon"; else if (backgroundcolor == 5 ) return "navy"; else if (backgroundcolor == 6 ) return "lime"; else if (backgroundcolor == 7 ) return "fuschia"; else if (backgroundcolor == 8 ) return "green"; else if (backgroundcolor == 9 ) return "purple"; else if (backgroundcolor == 10 ) return "gray"; else if (backgroundcolor == 11 ) return "yellow"; else if (backgroundcolor == 12 ) return "aqua"; else if (backgroundcolor == 13 ) return "black"; else if (backgroundcolor == 14 ) return "white"; else if (backgroundcolor == 15 ) return "silver"; } // End --> </SCRIPT> <!-- STEP TWO: Put this form in the BODY of the HTML document --> <BODY> <CENTER> <FORM> <p> <input type="button" value="انتخاب رنگ زمینه" onClick="randombackground()" style="border: 1px dotted #FFFFFF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"> <font face="Tahoma"><span style="font-size: 9pt"> <a target="_blank" href="http://www.iransohrab.net" style="text-decoration: none"> www.iransohrab.net</a></span></font></p> </FORM> </CENTER> <!-- Script Size: 2.00 KB -->