سلام . با وجود این که تایپک های دیگه هم زدم در باره ی جاوا script. و نسبت خوب بودن.دیگه خسته شدم و فکرکنم این آخرین ارسالیم باشه تو قسمت جاوا . به همین دلیل و کدهای مفید و کاربردی جاوا رو اینجا میزارم . البته هر کدی رو نه
درضمن هر کدی بزارم حتما سعی میکنم دموی اونهم رو بزارم.
کدهای متحرک متنی + کادر
این کد در گوشه چپ وبلاگ یه کادر باز میکنه . مانند کدهای نمایش مناسبت ها (ایام عاشورا و...)
<!-- BEGINNING OF THE CODE FOR THE DIAGONAL TEXT TICKER --><!----------------------------------------->
<!-- STYLE-CONFIGURATION STARTS HERE -->
<!----------------------------------------->
<center><style>
/* PLEASE NOTE that padding, width and height of ticker, border-width must be set within the script-code. See script code below! */
/* IMPORTANT you may change the direction of typing from bottom to top. See comments below within this style-zone */
a.textstyle {
color:#ffffff; /* You may change it */
font-family:Arial; /* You may change it */
font-size:16pt; /* You may change it */
font-weight:bold; /* You may change it */
text-decoration:none; /* You may change it */
}
a.textstyle:visited {
color:#ffffff; /* You may change it */
}
a.textstyle:hover {
color:yellow; /* You may change it */
}
.boxstyle {
background-color:#000000;/* You may change it */
border-color:#FF4500;/* You may change it */
opacity:1; /* Set the opacity for Firefox, Opera, Safari and Chrome. Values may range from 0 to 1 */
position:absolute; /* Do not change */
overflow:hidden; /* Do not change */
display: inline-block; /* Do not change */
-moz-transform: scale(1) rotate(-45deg) translate(0px); /* Do not change */
-webkit-transform: scale(1) rotate(-45deg) translate(0px); /* Do not change */
-o-transform: scale(1) rotate(-45deg) translate(0px); /* Do not change */
filter: /* Do not change */
progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', /* IE6,IE7 */ M11=0.7071067811865476, M12=0.7071067811865475, M21=-0.7071067811865475, M22=0.7071067811865476),
/* Do not change */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865476, M12=0.7071067811865475, M21=-0.7071067811865475, M22=0.7071067811865476, sizingMethod='auto expand')"
/* Do not change */ alpha(opacity=100); /* Set the opacity for Internet Explorer. Values may range from 0 to 100*/
}
</style>
<!----------------------------------------->
<!-- STYLE-CONFIGURATION ENDS HERE -->
<!----------------------------------------->
<script>
// CREDITS:
// Diagonal text ticker
// By Peter Gehrig
// Copyright (c) 2010-2011 Peter Gehrig. All rights reserved.
// edit code by masoud
// Permission given to use the script provided that this notice remains as is.
// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// where this script will be featured
var text=new Array()
var textlink=new Array()
var texttarget=new Array()
/////////////////////////////////////////////////
// SCRIPT-CONFIGURATION STARTS HERE
/////////////////////////////////////////////////
<!----------------www.20sof.r98.ir پیغام ها -------------->
// Your messages. Add as many as you like. Experienced webmasters may even embed simple HTML-tags
// Use short messages as this is a one-line-ticker
text[0]="کد حرفه ای نمایش متن"
text[1]="مختص ایام عاشورا"
text[2]="ادامه متن شما "
// Add a link for each message
// Enter "#" if you don't want to link a message (see sample below)
textlink[0]="http://www.my link 1.com"
textlink[1]="http://www.my link 2.com"
textlink[2]="http://www.my link 3.com"
<!----------------www.20sof.r98.ir پیغام ها -------------->
// Add the target of the link
// Accepted values are "_blank","_top", "_self", "_parent" or the name of any frame
texttarget[0]="_top"
texttarget[1]="_top"
texttarget[2]="_top"
// width and height of ticker (pixels)
var textwidth=350
var textheight=38
// pause between the messages (seconds)
var textpause=3
// border-width (enter 0 if you don't want to add a border)
var textborder=4
// padding of text, distance to border (pixels)
var textpadding=5
// speed (higher=slower)
var speed=40
// set the horizontal position for Firefox, Chrome, Opera
var x_position=-72
// set the vertical position for Firefox, Chrome, Opera
var y_position=82
// set the horizontal position for Internet Explorer
var x_positionIE=-46
// set the vertical position for Internet Explorer
var y_positionIE=-35
/////////////////////////////////////////////////
// SCRIPT-CONFIGURATION ENDS HERE
/////////////////////////////////////////////////
// Do not edit below this line
if (document.all) {
var marginright=document.body.clientWidth-textheight
}
else {
var marginright=window.innerWidth-textheight
}
var okbrowser=false
var okbr=false
var agt=navigator.userAgent.toLowerCase();
okbr= (agt.indexOf("opera 9") != -1 || agt.indexOf("opera/9") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 10") != -1 || agt.indexOf("opera/10") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 11") != -1 || agt.indexOf("opera/11") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 12") != -1 || agt.indexOf("opera/12") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 13") != -1 || agt.indexOf("opera/13") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 14") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 15") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 16") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 17") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 18") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 19") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr= (agt.indexOf("opera 20") != -1 || agt.indexOf("opera/14") != -1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/3") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/4") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/5") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/6") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/7") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/8") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/9") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/10") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/11") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/12") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/13") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/14") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("chrome/15") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/3.6") !=-1 || agt.indexOf("firefox/.36") !=-1 || agt.indexOf("firefox/0.36") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/3.7") !=-1 || agt.indexOf("firefox/.37") !=-1 || agt.indexOf("firefox/0.37") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/3.8") !=-1 || agt.indexOf("firefox/.38") !=-1 || agt.indexOf("firefox/0.38") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/3.9") !=-1 || agt.indexOf("firefox/.39") !=-1 || agt.indexOf("firefox/0.39") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/4") !=-1 || agt.indexOf("firefox/.4") !=-1 || agt.indexOf("firefox/0.4") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/5") !=-1 || agt.indexOf("firefox/.5") !=-1 || agt.indexOf("firefox/0.5") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/6") !=-1 || agt.indexOf("firefox/.6") !=-1 || agt.indexOf("firefox/0.6") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/7") !=-1 || agt.indexOf("firefox/.7") !=-1 || agt.indexOf("firefox/0.7") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/8") !=-1 || agt.indexOf("firefox/.9") !=-1 || agt.indexOf("firefox/0.8") !=-1);
if (okbr) {okbrowser=true}
okbr = (agt.indexOf("firefox/9") !=-1 || agt.indexOf("firefox/.9") !=-1 || agt.indexOf("firefox/0.9") !=-1);
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/3')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/4')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/5')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/6')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/7')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/8')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
okbr= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('version/9')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
if (okbr) {okbrowser=true}
var i_mes=0
var i_substring=0
var i_presubstring=0
var i_text=0
var textcontent=""
var notag=true
var textpresubstring=""
var textaftersubstring=""
textpause*=1000
var browserinfos=navigator.userAgent
var ie4=!document.getElementById&&document.all&&!browserinfos.match(/Opera/)
var ie5=document.getElementById&&document.all&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)
function gettextcontent() {
tablewidth=textwidth-2*textborder
tableheight=textheight-2*textborder
textpresubstring=text[i_text].substring(0,i_presubstring)
var i_prepre=i_presubstring-1
if (i_prepre<0) {i_prepre=0}
if (text[i_text].substring(i_prepre,i_presubstring)=="<"){notag=false}
if (text[i_text].substring(i_prepre,i_presubstring)==">"){notag=true}
if (notag) {
textcontent="<table width="+textwidth+" height="+textheight+" cellpadding="+textpadding+"><tr valign=middle><td align=center>"
textcontent+="<a href='"+textlink[i_text]+"' target='"+texttarget[i_text]+"' class='textstyle'>"
textcontent+=textpresubstring
textcontent+="</a>"
textcontent+="</td></tr></table>"
}
}
function showticker() {
if (i_substring<=text[i_text].length) {
i_substring++
i_presubstring=i_substring-1
if (i_presubstring<0) {i_presubstring=0}
gettextcontent()
document.getElementById("ticker").innerHTML=textcontent
var timer=setTimeout("showticker()", speed)
}
else {
clearTimeout(timer)
var timer=setTimeout("changetext()", textpause)
}
}
function changetext() {
i_substring=0
i_presubstring=0
i_text++
if (i_text>text.length-1) {
i_text=0
}
showticker()
}
if (okbrowser) {
document.write('<div ID="ticker" class="boxstyle" style="width:'+textwidth+'px;height:'+textheight+'px;left:'+x_position+'px;top:'+y_position+'px;border-width:'+textborder+'px;border-style:solid;">')
document.write('</div>')
window.onload=showticker
}
else if (document.all) {
document.write('<div ID="ticker" class="boxstyle" style="width:'+textwidth+'px;height:'+textheight+'px;left:'+x_positionIE+'px;top:'+y_positionIE+'px;border-width:'+textborder+'px;border-style:solid;">')
window.onload=showticker
}
</script>
<!-- END OF THE CODE FOR THE DIAGONAL TEXT TICKER -->
کدهای متحرک متنی + کادر
اینم کد دوم : متن های افکت دار در کادر صورتی
دموی این کد رو ببنید!!
<!-- BEGINNING OF THE CODE FOR THE STRETCH-TICKER --><!----------------------------------------->
<!-- STYLE-CONFIGURATION STARTS HERE -->
<!----------------------------------------->
<center><style>
#stage {
/* #stage should contain all style-attributes that remain unchanged during the animation */
/* Do not change the name of #stage!!! */
font-family:Arial;
font-size:16pt;
background:#FF1493;
width:300px;
text-align: center;
vertical-align:middle;
border: 4px solid #FFFFFF ;
overflow:hidden;
padding:8px;
cursor: pointer;
/* shadow for Firefox */
-moz-box-shadow: 5px 5px 5px #ffaaaa;
/* shadow for Chrome and Safari */
-webkit-box-shadow: 5px 5px 5px #ffaaaa;
/* shadow for Opera */
box-shadow: 5px 5px 5px #ffaaaa;
/* shadow for Internet Explorer */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=135, Color='#ffaaaa');
/* rounded corners for Firefox */
-moz-border-radius-topleft: 15px;
-moz-border-radius-bottomright: 15px;
/* rounded corners for Chrome and Safari */
-webkit-border-top-left-radius: 15px;
-webkit-border-bottom-right-radius: 15px;
/* rounded corners for Opera */
border-top-left-radius: 15px;
border-bottom-right-radius: 15px;
}
/* Below are the classes describing the changes of style-attributes during the animation */
/* Each class acts like a frame in a movie */
/* You may add as many classes as you like */
/* You may name the classes as you like. In this samplae I named them a, b, c ... and so on */
/* In this sample I changed 2 attributes: the width between the letters and the color */
/* You may change other attributes. It's up to you! */
.a {
color:#696969 ;
letter-spacing:40px;
}
.b {
color:#ff2222;
letter-spacing:38px;
}
.c {
color:#ff2222;
letter-spacing:36px;
}
.d {
color:#ff3333;
letter-spacing:34px;
}
.e {
color:#ff4444;
letter-spacing:32px;
}
.f {
color:#ff5555;
letter-spacing:30px;
}
.g {
color:#ff6666;
letter-spacing:28px;
}
.h {
color:#ff7777;
letter-spacing:26px;
}
.i {
color:#ff8888;
letter-spacing:24px;
}
.k {
color:#ff9999;
letter-spacing:22px;
}
.l {
color:#ffaaaa;
letter-spacing:20px;
}
.m {
color:#ffbbbb;
letter-spacing:17px;
}
.n {
color:#ffcccc;
letter-spacing:14px;
}
.o {
color:#ffdddd;
letter-spacing:10px;
}
.p {
color:#ffeeee;
letter-spacing:5px;
}
.q {
color:#ffffff;
letter-spacing:0px;
}
</style>
<!----------------------------------------->
<!-- STYLE-CONFIGURATION ENDS HERE -->
<!----------------------------------------->
<script>
// CREDITS:
// CSS-controlled stretch ticker
// by Peter Gehrig
// Copyright (c) 2010 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.fabulant.com
// 09/02/2010
// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a link to http://www.fabulant.com on the webpage
// where this script will be running.
// CONFIGURATION:
// Go to http://www.fabulant.com and get the original code
// with step-by-step instructions and copy-and-paste installation.
/////////////////////////////////////////////////
// SCRIPT-CONFIGURATION STARTS HERE
/////////////////////////////////////////////////
// The array 'classes_pull_together_animation' contains the 'frames' required for the pull-together-animation
// Enter the class-names. The order is up to you
// In this sample class 'a' will be played first, then class 'b', then class 'c' an so on
var classes_pull_together_animation=new Array("a","b","c","d","e","f","g","h","i","k","l","m","n","o","p","q")
//www.20soft.r98.ir // ("v", , , , , ," , , ," , ," ,"
// The array 'classes_stretch_animation' contains the 'frames' required for the stretch-animation
// Enter the class-names. The order is up to you
// In this sample class 'q' will be played first, then class 'p', then class 'n' an so on
var classes_stretch_animation=new Array("q","p","n","m","l","k","i","h","g","f","f","e","e","d","c","b","a")
// Set the messages. You may add as many messages as you like
var message=new Array()
message[0]="چه میخواهید ؟؟؟؟؟"
message[1]="سرویس وبلاگدهی قدرتمند ؟"
message[2]="پیشنهاد سرویس رزبلاگ است"
// Set a link for each message. You may add as many messages as you like
// If you don't want to add a link enter a "#" instead of the URL. See sample below
var messagelink=new Array()
messagelink[0]="https://www.rozblog.com"
messagelink[1]="https://www.rozblog.com"
messagelink[2]="https://www.rozblog.com"
// Set the speed of the animation from class to class (frame to frame). High values = slow speed
var speed=40
// Set the standstill-time of message (seconds)
var pause=2
/////////////////////////////////////////////////
// SCRIPT-CONFIGURATION ENDS HERE
/////////////////////////////////////////////////
// do not edit below this line
var i_classnames=0
var i_message=0;
var i_messagelink=0;
var tmr
pause*=1000
var spc="\&"+"nbsp;"
for (i=0;i<message.length;i++) {
message=message.replace(/[" "]/g,spc)
}
function setcontent() {
i_messagelink=i_message
if (i_message>=message.length) {
i_message=0
}
if (i_messagelink>=message.length) {
i_messagelink=0
}
document.getElementById("stage").innerHTML=message[i_message]
i_message++
i_classnames=0
pull_together()
}
function pull_together() {
if (i_classnames<=classes_pull_together_animation.length-1) {
document.getElementById("stage").className=classes_pull_together_animation[i_classnames]
i_classnames++
tmr=setTimeout("pull_together()",speed)
}
else {
clearTimeout(tmr);
i_classnames=0
setTimeout("stretch()",pause)
}
}
function stretch() {
if (i_classnames<=classes_stretch_animation.length-1) {
document.getElementById("stage").className=classes_stretch_animation[i_classnames]
i_classnames++
tmr=setTimeout("stretch()",speed)
}
else {
clearTimeout(tmr);
i_classnames=0
setTimeout("setcontent()",500)
}
}
function gotourl() {
document.location.href=messagelink[i_messagelink]
}
window.onload=setcontent
</script>
<div id="stage" onclick="gotourl()"></div>
<!-- END OF THE CODE FOR THE STRETCH-TICKER -->
اینم کد سوم: که خیلی جالب هست .
متن های متحرک رو تمام صفحه میکنه!!!!!!!
دموی این کد رو حتما اینجا ببینید!!!!!!!!!!
<script>// CREDITS:
// Fullpage Background-Ticker 2.2 by Peter Gehrig
// Copyright (c) 2011 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// scripts by masoud.rzb //
// IMPORTANT:
// If you add this script to a script-library or a script-archive
// will be displayed.
<!-------------20soft.r98.ir شروع متن ها ----------------->
// Set your messages. You may add as many messages as you like.
var message=new Array()
message[0]="توجه هر گونه کپی برداری از مطالب این سایت "
message[1]="پیگرد قاونی خواهد داشت"
message[2]=" بهترین و قویترین سرویس وبلاگدهی www.rozblog.com"
// Set font-family of the text
var fnt="Arial"
// Set font-size of the text (CSS-values)
var fntsize=50
// Set font-color of the text
var fntcolor="#CCCCCC"
// Set font-color of the last letter of the ticker
var fntcolorlastletter="#666666"
// Set font-weight. Set a value between 1 to 9 to adjust the boldness
var fntweight=7
// Set standstill between the messages (seconds)
var standstill=3
// Set speed (higher=slower)
var speed=80
// the top-position of the ticker (distance to the border on top, pixels)
var topposition=200
// the left-position of the ticker (distance to the border on the left, pixels)
var leftposition=20
// Do not edit the variables below
var tickerwidth
var tickerheight
var i_substring=0
var i_presubstring=0
var i_message=0
var messagecontent=""
var messagebackground=""
var messagepresubstring=""
var messageaftersubstring=""
fntweight=fntweight*100
standstill*=1000
<!-------------20soft.r98.ir شروع متن ها ----------------->
var browserinfos=navigator.userAgent
var ie4=document.all&&!document.getElementById&&!browserinfos.match(/Opera/)
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns4=document.layers
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)
var browserok=ie4||ie5||ns4||ns6||opera
for (i=0;i<=message.length-1;i++) {
message=message+" "
}
function initiateticker() {
tickerheight=document.body.clientHeight-5
tickerwidth=document.body.clientWidth-5
document.getElementById('ticker').style.left=leftposition
document.getElementById('ticker').style.top=topposition
showticker()
}
function getmessagecontent() {
messagepresubstring=message[i_message].substring(0,i_presubstring)
messageaftersubstring=message[i_message].substring(i_presubstring,i_substring)
messagecontent="<table border=0 width="+tickerwidth+" height="+tickerheight+"><tr><td valign=top>"
messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:"+fntweight+"'>"
messagecontent+="<font color='"+fntcolor+"'>"
messagecontent+=messagepresubstring
messagecontent+="</font>"
messagecontent+="</span>"
messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:900'>"
messagecontent+="<font color='"+fntcolorlastletter+"'>"
messagecontent+=messageaftersubstring
messagecontent+="</font>"
messagecontent+="</span>"
messagecontent+="</td></tr></table>"
}
function showticker() {
if (i_substring<=message[i_message].length-1) {
i_substring++
i_presubstring=i_substring-1
if (i_presubstring<0) {i_presubstring00}
getmessagecontent()
document.getElementById('ticker').innerHTML=messagecontent
var timer=setTimeout("showticker()", speed)
}
else {
clearTimeout(timer)
var timer=setTimeout("changemessage()", standstill)
}
}
function changemessage() {
i_substring=0
i_presubstring=0
i_message++
if (i_message>message.length-1) {
i_message=0
}
showticker()
}
if (browserok) {window.onload=initiateticker}
</script>
<DIV ID="ticker" style="position:absolute"></DIV>
<DIV ID="do_not_delete_this" style="position:relative">
| یاد آوری کنم . من اینجا به هیچ وقت بلیغ نمیکنم. و خداشاهده فقط هدفم خدمت به شماست.
4-
اینم زیباترین کد از این نوع کدها
کد بارش برف !! دوستان اشتباه نگیرد . اینبار برف نمیاد . بجاش : آقای temp98 ,و masoud و... از آسمان به صورت معلق میایم پایین . // حتما دموی این کد رو ببینید!!
دموی کد دوستان معلق در هوا
<script>// CREDITS:
// Snowmessage
// By Peter Gehrig
// Copyright (c) 2011
// EDIT By masoud.rzb
// Permission given to use the script provided that this notice remains as is.
// IMPORTANT:
// If you add this script to a script-library or script-archive
// where this script will be featured
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////
//
<!---------------20soft.r98.ir رنگ ها و متن های اصلی ----------->
// Set the number of snowflakes (more than 30 - 40 not recommended)
var snowmax=32
// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#aaaacc","#FF1493","#FF4500","#1E90FF")
// info by masoud // color #FF1493 RED
// info by masoud // color #FF4500 Orange
// info by masoud // color #1E90FF Sky - blue
// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS","Courier")
// Set the messages
var snowmessage=new Array ("Temp98", "Rozblog", "Masoud", "Admin", "Reza", "Arsalan")
// Set the speed of sinking (recommended values range from 0.3 to 2)
var sinkspeed=0.6
// Set the maximal-size of your snowflaxes
var snowmaxsize=18
// Set the minimal-size of your snowflaxes
var snowminsize=7
// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing
var snowingzone=3
<!---------------20soft.r98.ir رنگ ها و متن های اصلی ----------->
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////
// Do not edit below this line
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var i_text=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)
var browserok=ie5||ns6||opera
function randommaker(range) {
rand=Math.floor(range*Math.random())
return rand
}
function initsnow() {
if (ie5 || opera) {
marginbottom = document.body.clientHeight
marginright = document.body.clientWidth
}
else if (ns6) {
marginbottom = window.innerHeight
marginright = window.innerWidth
}
var snowsizerange=snowmaxsize-snowminsize
for (i=0;i<=snowmax;i++) {
crds = 0;
lftrght = Math.random()*15;
x_mv = 0.03 + Math.random()/10;
snow=document.getElementById("s"+i)
snow.style.fontFamily=snowtype[randommaker(snowtype.length)]
snow.size=randommaker(snowsizerange)+snowminsize
snow.style.fontSize=snow.size+"pt"
snow.style.color=snowcolor[randommaker(snowcolor.length)]
snow.sink=sinkspeed*snow.size/5
if (snowingzone==1) {snow.posx=randommaker(marginright-snow.size)}
if (snowingzone==2) {snow.posx=randommaker(marginright/2-snow.size)}
if (snowingzone==3) {snow.posx=randommaker(marginright/2-snow.size)+marginright/4}
if (snowingzone==4) {snow.posx=randommaker(marginright/2-snow.size)+marginright/2}
snow.posy=randommaker(2*marginbottom-marginbottom-2*snow.size)
snow.style.left=snow.posx+"px"
snow.style.top=snow.posy+"px"
}
movesnow()
}
function movesnow() {
for (i=0;i<=snowmax;i++) {
crds += x_mv;
snow.posy+=snow.sink
snow.style.left=(snow.posx+lftrght*Math.sin(crds))+"px";
snow.style.top=snow.posy+"px"
if (snow.posy>=marginbottom-2*snow.size || parseInt(snow.style.left)>(marginright-3*lftrght)){
if (snowingzone==1) {snow.posx=randommaker(marginright-snow.size)}
if (snowingzone==2) {snow.posx=randommaker(marginright/2-snow.size)}
if (snowingzone==3) {snow.posx=randommaker(marginright/2-snow.size)+marginright/4}
if (snowingzone==4) {snow.posx=randommaker(marginright/2-snow.size)+marginright/2}
snow.posy=0
}
}
var timer=setTimeout("movesnow()",60)
}
for (i=0;i<=snowmax;i++) {
document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"px'>"+snowmessage[i_text]+"</span>")
i_text++;
if (i_text>=snowmessage.length) {
i_text=0;
}
}
if (browserok) {
window.onload=initsnow
}
</script>
بزودی چند کد دیگه هم قرار میدم.


