|
|
|
|
منوی متحرک در صفحه <script> if (!document.div) document.write('<div id="divStayTopLeft" style="position:absolute">') </script>
<div id="divStayTopLeft">
<!--EDIT BELOW CODE TO YOUR OWN MENU--> <table width="130" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC"> <tr> <td width="100%" bgcolor="#0066CC"> <p align="center" class="style1"><font size="4">Menu</font></p></td> </tr> <tr> <td width="100%" align="center" bgcolor="#f5f5f5"> <p align="center"> <a href="http://www.dynamicdrive.com" target="_blank"><br> webkaran</a><br> ----------<br> <a href="http://www.yahoo.com/" target="_blank">yahoo!</a><br> ----------<br> <a href="http://www.google.com/" target="_blank">Google</a><br> ----------<br> <a href="http://www.ask.com/" target="_blank">Ask</a><br> <br>
</p>
</td> </tr> </table> <!--END OF EDIT--> </div>
<script type="text/javascript">
//Enter "frombottom" or "fromtop" var verticalpos="frombottom"
if (!document.layers) document.write('</div>')
function JSFX_FloatTopDiv() { var startX = 20, startY = 190; var ns = (navigator.appName.indexOf("Netscape") != -1); var d = document; function ml(id) { var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; if(d.layers)el.style=el; el.sP=function(x,y){this.style.left=x;this.style.top=y;}; el.x = startX; if (verticalpos=="fromtop") el.y = startY; else{ el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight; el.y -= startY; } return el; } window.stayTopLeft=function() { if (verticalpos=="fromtop"){ var pY = ns ? pageYOffset : document.body.scrollTop; ftlObj.y += (pY + startY - ftlObj.y)/8; } else{ var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight; ftlObj.y += (pY - startY - ftlObj.y)/8; } ftlObj.sP(ftlObj.x, ftlObj.y); setTimeout("stayTopLeft()", 10); } ftlObj = ml("divStayTopLeft"); stayTopLeft(); } JSFX_FloatTopDiv(); </script>
|
|
|
متن مخفی که با کلیک روی لینک ظاهر می گردد. <head> <SCRIPT language=javascript type=text/javascript> function archives(Down) { current=(document.getElementById(Down).style.display == "none") ? "block" : "none"; document.getElementById(Down).style.display = current; } </SCRIPT> </head>
<body> <A onclick="archives('archives'); return false;" href="#">Click Here</a> <DIV id=archives style="DISPLAY: none">*** Welcome to Our Website *** </DIV>
</body>
|
|
|
حرکت دو خط همراه نشانگر ماوس <!-- START OF Mouse Cursor Crosshairs DHTML -->
<!-- Put this portion of the script inside of your <HEAD> tag -->
<style> <!--
#leftright, #topdown{ position: absolute; left: 0; top: 0; width: 1px; height: 1px; layer-background-color: #aaaaaa; background-color: #aaaaaa; z-index: 100; font-size: 1px; }
--> </style>
<!-- Put this code after your <BODY> tag --> <div id="leftright" style="width:expression(document.body.clientWidth-2)"></div> <div id="topdown" style="height:expression(document.body.clientHeight-2)"></div>
<script language="javascript1.2"> <!--
if (document.all&&!window.print){ leftright.style.width=document.body.clientWidth-2 topdown.style.height=document.body.clientHeight-2 } else if (document.layers){ document.leftright.clip.width=window.innerWidth document.leftright.clip.height=1 document.topdown.clip.width=1 document.topdown.clip.height=window.innerHeight } function followmouse1(){ //move cross engine for IE 4+ leftright.style.pixelTop=document.body.scrollTop+event.clientY+1 topdown.style.pixelTop=document.body.scrollTop if (event.clientX<document.body.clientWidth-2) topdown.style.pixelLeft=document.body.scrollLeft+event.clientX+1 else topdown.style.pixelLeft=document.body.clientWidth-2 }
function followmouse2(e){ //move cross engine for NS 4+ document.leftright.top=e.y+1 document.topdown.top=pageYOffset document.topdown.left=e.x+1 }
if (document.all) document.onmousemove=followmouse1 else if (document.layers){ window.captureEvents(Event.MOUSEMOVE) window.onmousemove=followmouse2 }
function regenerate(){ window.location.reload() } function regenerate2(){ setTimeout("window.onresize=regenerate",400) } if ((document.all&&!window.print)||document.layers) //if the user is using IE 4 or NS 4, both NOT IE 5+ window.onload=regenerate2 //--> </script> <!-- END OF Mouse Cursor Crosshairs DHTML -->
|
|
|
نمایش لود شدن صفحه تا بارگزاری کامل آن IE 6+, FF1+, Opera 9+ | <head> <script language="javascript" type="text/javascript"> <!-- function change(){ document.all["loading"].style.visibility="hidden"; } //--> </script> </head> <body> <div id="loading" style="position:absolute; z-index:4; width: 26%; visibility: visible; height: 60px; margin-top:100px; background-repeat:no-repeat; border: 1px dashed #777777; background-color: #FFFFdd; left: 36%;" > <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td height="50" align="center" valign="middle"><img src="مسیر آیکن مورد نظر خود"></td> </tr> <tr> <td height="20" align="center" valign="middle" style="direction:rtl"><span class="style110">لطفا" تا بارگزاری کامل صفحه صبر کنید.</span></td> </tr> </table> </div></body> همچنین به تگ body صفحه عبارت onload="change()" را اضافه نمایید.
|
|
|
تقویم میلادی با فرمتهای مختلف <!-- Format: 9-6-2008 -->
<script language="javascript" type="text/javascript"> <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development var today_date= new Date() var month=today_date.getMonth()+1 var today=today_date.getDate() var year=today_date.getYear() //document.write("Today's date is: ") document.write(month+"-"+today+"-"+year) //--> </script>
<!-- Format: October: 17, 2008 -->
<head> <script language="javascript" type="text/javascript"> <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development var today_date= new Date() var month=today_date.getMonth() var today=today_date.getDate() var year=today_date.getYear()
var months = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); // --> </script> </head> <!-- این قسمت از کد را در محل مورد نظر در صفحه کپی نمایید --> <SCRIPT language=javascript> <!-- Script courtesy of Web-Source.net - Your Guide to Professional Web Site Design and Development document.write(months[month]+" "+today+", "+year) // --> </script>
|
|
|
تعیین زمان برای بازدید از صفحه و رفتن به صفحه مورد نظر <div align="center"> <form name="redirect"> <input type="text" size="2" name="redirect2" style="text-align:center; width:35px"> Seconds </form></div> <script> <!-- var targetURL="http://www.mzb.ir./" var countdownfrom=10 var currentsecond=document.redirect.redirect2.value=countdownfrom+1 function countredirect(){ if (currentsecond!=1){ currentsecond-=1 document.redirect.redirect2.value=currentsecond } else{ window.location=targetURL return } setTimeout("countredirect()",1000) }countredirect() //--> </script>
|
|
|
تقویم شمسی function showdate() { week= new Array("يكشنبه","دوشنبه","سه شنبه","چهارشنبه", "پنجشنبه","جمعه","شنبه") months = new Array("فروردين","ارديبهشت","خرداد","تير","مرداد", "شهريور","مهر","آبان","آذر","دي","بهمن","اسفند"); a = new Date(); d= a.getDay(); day= a.getDate(); month = a.getMonth()+1; year= a.getYear(); if (year== 0){year=2000;} if (year<100){year +=1900;} y=1; for(i=0;i<3000;i+=4) { if (year==i) {y=2;} } for(i=1;i<3000;i+=4) { if (year==i) {y=3;} } if (y==1) { year -= ( (month < 3) || ((month == 3) && (day < 21)) )? 622:621;
switch (month) { case 1: (day<21)? (month=10, day+=10):(month=11, day-=20); break; case 2: (day<20)? (month=11, day+=11):(month=12, day-=19); break; case 3: (day<21)? (month=12, day+=9):(month=1, day-=20); break; case 4: (day<21)? (month=1, day+=11):(month=2, day-=20); break; case 5: case 6: (day<22)? (month-=3, day+=10):(month-=2, day-=21); break; case 7: case 8: case 9: (day<23)? (month-=3, day+=9):(month-=2, day-=22); break; case 10:(day<23)? (month=7, day+=8):(month=8, day-=22); break; case 11: case 12:(day<22)? (month-=3, day+=9):(month-=2, day-=21); break; default: break; } } if (y==2) { year -= ( (month < 3) || ((month == 3) && (day < 20)) )? 622:621;
switch (month) { case 1: (day<21)? (month=10, day+=10):(month=11, day-=20); break; case 2: (day<20)? (month=11, day+=11):(month=12, day-=19); break; case 3: (day<20)? (month=12, day+=10):(month=1, day-=19); break; case 4: (day<20)? (month=1, day+=12):(month=2, day-=19); break; case 5: (day<21)? (month=2, day+=11):(month=3, day-=20); break; case 6: (day<21)? (month=3, day+=11):(month=4, day-=20); break; case 7: (day<22)? (month=4, day+=10):(month=5, day-=21); break; case 8: (day<22)? (month=5, day+=10):(month=6, day-=21); break; case 9: (day<22)? (month=6, day+=10):(month=7, day-=21); break; case 10:(day<22)? (month=7, day+=9):(month=8, day-=21); break; case 11:(day<21)? (month=8, day+=10):(month=9, day-=20); break; case 12:(day<21)? (month=9, day+=10):(month=10, day-=20); break; default: break; } } if (y==3) { year -= ( (month < 3) || ((month == 3) && (day < 21)) )? 622:621; switch (month) { case 1: (day<20)? (month=10, day+=11):(month=11, day-=19); break; case 2: (day<19)? (month=11, day+=12):(month=12, day-=18); break; case 3: (day<21)? (month=12, day+=10):(month=1, day-=20); break; case 4: (day<21)? (month=1, day+=11):(month=2, day-=20); break; case 5: case 6: (day<22)? (month-=3, day+=10):(month-=2, day-=21); break; case 7: case 8: case 9: (day<23)? (month-=3, day+=9):(month-=2, day-=22); break; case 10:(day<23)? (month=7, day+=8):(month=8, day-=22); break; case 11: case 12:(day<22)? (month-=3, day+=9):(month-=2, day-=21); break; default: break; } } document.write(week[d]+" "+day+" "+months[month-1]+" "+ year); }
<FONT face="tahoma size=2" color="#000000"> showdate() </FONT>
|
|
|
دکمه ای برای بستن پنجره <!-- ONE STEP TO INSTALL CLOSE WINDOW: 1. Copy the coding into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the BODY of your HTML document --> <BODY> <!-- This script and many more are available free online at --> <!-- The javascript Source!! http://javascript.internet.com --> <form> <input type=button value="Close Window" onclick="javascript:window.close();"> </form>
|
|
|
جلوگیری از انتخاب متن <script language="javascript" type="text/javascript"> function disableselect(e){ return false } function reEnable(){ return true } document.onselectstart=new Function ("return false") if (window.sidebar){ document.onmousedown=disableselect document.onclick=reEnable } </script>
|
|
|
تقویم میلادی با جدول بندی <script language="javascript" type="text/javascript"> <!-- Begin monthnames = new Array( "January", "Februrary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Decemeber"); var linkcount=0; function addlink(month, day, href) { var entry = new Array(3); entry[0] = month; entry[1] = day; entry[2] = href; this[linkcount++] = entry; } Array.prototype.addlink = addlink; linkdays = new Array(); monthdays = new Array(12); monthdays[0]=31; monthdays[1]=28; monthdays[2]=31; monthdays[3]=30; monthdays[4]=31; monthdays[5]=30; monthdays[6]=31; monthdays[7]=31; monthdays[8]=30; monthdays[9]=31; monthdays[10]=30; monthdays[11]=31; todayDate=new Date(); thisday=todayDate.getDay(); thismonth=todayDate.getMonth(); thisdate=todayDate.getDate(); thisyear=todayDate.getYear(); thisyear = thisyear % 100; thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear)); if (((thisyear % 4 == 0) && !(thisyear % 100 == 0)) ||(thisyear % 400 == 0)) monthdays[1]++; startspaces=thisdate; while (startspaces > 7) startspaces-=7; startspaces = thisday - startspaces + 1; if (startspaces < 0) startspaces+=7; document.write("<table border=2 bgcolor=white "); document.write("bordercolor=black>"); document.write("<tr><td colspan=7 style='font-size:13px'><center>" + monthnames[thismonth] + " " + thisyear + "</center></td></tr>"); document.write("<tr style='font-size:11px'>"); document.write("<td align=center>Su</td>"); document.write("<td align=center>M</td>"); document.write("<td align=center>Tu</td>"); document.write("<td align=center>W</td>"); document.write("<td align=center>Th</td>"); document.write("<td align=center>F</td>"); document.write("<td align=center>Sa</td>"); document.write("</tr>"); document.write("<tr style='font-size:11px'>"); for (s=0;s<startspaces;s++) { document.write("<td> </td>"); } count=1; while (count <= monthdays[thismonth]) { for (b = startspaces;b<7;b++) { linktrue=false; document.write("<td>"); for (c=0;c<linkdays.length;c++) { if (linkdays[c] != null) { if ((linkdays[c][0]==thismonth + 1) && (linkdays[c][1]==count)) { document.write("<a href=\"" + linkdays[c][2] + "\">"); linktrue=true; } } } if (count==thisdate) { document.write("<font face='arial' size='-1' color='cc0000'><strong>"); } if (count <= monthdays[thismonth]) { document.write(count); } else { document.write(" "); } if (count==thisdate) { document.write("</strong></font>"); } if (linktrue) document.write("</a>"); document.write("</td>"); count++; } document.write("</tr>"); document.write("<tr style='font-size:11px'>"); startspaces=0; } document.write("</table></p>"); // End --> </SCRIPT>
|
|