PDA

View Full Version : نمونه برنامه هایی زیبااز JavaScript توی این تاپیک وجود داره



nasr
یک شنبه 13 اردیبهشت 1383, 16:44 عصر
سلام

هرکس هرنمونه برنامه از JavaScript داره توی این تاپیک بگذاره تا بقیه هم از اون استفاده کنند

این هم اولیش



<html dir="rtl">

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<script language="JavaScript">

text=new Array('Welcome to','Barnamenevis','site!','welcome to topic Nasr')


//set the number of text's


var numText=4


//Now the colors:


//all you have to do is set the color you want to have in here:


//(the first color will be the color that the text is when it zooms.)


color=new Array('#000099','#0066ff','#00ccff','#00ffff','#cc ffff')


//set the number of colors:


var numColors=5

//set the size you want the zoom to end at:

var endSize=52

//Set the speed you want it to zoom in (in milliseconds)
var Zspeed=200

//Set the speed you want it too change colors in
var Cspeed=250

//Set font

var font='Arial, Helvetica'

//do you want it to hide when its done? (true or false)

var hide=true

/*You shouldn't really have to set anything below this point


################################################## ####################

################################################## ####################

################################################## ####################*/


var size=10


var gonum=0


/*Browsercheck and settings vars


################################################## ####################*/


if (document.all) {


n=0


ie=1


zoomText='document.all.zoom.innerText=text[num]'


zoomSize='document.all.zoom.style.fontSize=size'


closeIt=""


fadeColor="document.all.zoom.style.color=color[num]"


}


if (document.layers) {


n=1;ie=0


zoomText=""


zoomSize="document.zoom.document.write('<p align=\"center\" style=\"font-family:'+font+'; font-size:'+size+'px; color:'+color[0]+'\">'+text[num]+'</p>')"


closeIt="document.zoom.document.close()"


fadeColor="document.zoom.document.write('<p align=\"center\" style=\"font-family:'+font+'; font-size:'+endSize+'px; color:'+color[num]+'\">'+text[numText-1]+'</p>')"


}





/*The functions for zooming text.


################################################## ##################*/


function zoom(num,fn){


if (size<endSize){


eval(zoomText)


eval(zoomSize)


eval(closeIt)


size+=5;


setTimeout("zoom("+num+",'"+fn+"')",Zspeed)


}else{


eval(fn);


}


}


/*The functions for fading/changing colors on text


################################################## ##################*/


function fadeIt(num){


if (num<numColors){


eval(fadeColor)


eval(closeIt)


num+=1;


setTimeout("fadeIt("+num+")",Cspeed)


}else{


hideIt()


}


}


/*This is the function that hides the layer after the zoom/color change


################################################## ##################*/


function hideIt(){


if(hide){


if(ie)document.all.zoom.style.visibility="hidden"


if(n)document.layers.zoom.visibility="hidden"


}


}


/*This is the functions that calls the right function...or something :}


################################################## ##################*/


function init(){


if(ie){


document.all.zoom.style.color=color[0]


document.all.zoom.style.fontFamily=font}


go(0)


}


function go(num){


gonum+=1


size=10


if(num<numText){


zoom(num,'go('+gonum+')')


}else{


fadeIt(0)


}


}


//################################################## ##################
// -->
</script>
<body onload="init()">
<center><h1> </h1></center>
<div id="zoom" align="center" style="position:absolute; top:150">Welcome to JavaScript Resources</div>
<div id="footer+text" style="position: absolute; left: 10; top: 230"><layer name="footer+text" left=10 top=230>
<p> </p><p>.</p>
</body>

</html>
</html>
با امید همکاری

nasr
دوشنبه 14 اردیبهشت 1383, 10:02 صبح
سلام

لطفا بگید اینکار خوب هست که ادامه بدیم یا نه

با تشکر

ehsan-ets
سه شنبه 15 اردیبهشت 1383, 20:25 عصر
خیلی خوبه ولی اگر اینا رو به صورت جدا جدا و دستاه بندی شده+ اینکه برای هرنمونه یه فایل آپلود کنی عالیه یعنی یه صفحه بسازی و این برنامه رو توش اجرا کنی :) :تشویق:

nasr
چهارشنبه 16 اردیبهشت 1383, 21:10 عصر
خوب شما هم می تونید این متن را داخل یه فایل text کپی کنید و با پسوند html ذخیره کنید و اجراش کنید

فکر کنم همین می شه که شما دوست دارید

در ضمن من دوست دارم همه تو این کار شرکت کنند

من که تنها نمی تونم

nasr
یک شنبه 20 اردیبهشت 1383, 15:20 عصر
این هم دومیش

قرار دادن لینک های متحرک در صفحه



<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Introduction</title>
</head>

<body>
<html>
<head>
<title>JavaScript Resources - Flying Links</title>
<style>
.fly {
font-family: Arial, Helvetica;
font-size: large;
color: #0000ff;
position: absolute;
visibility: hidden;
z-index: 2;
}

.logo {
font-family: Zap-Chance, cursive;
font-size: xx-large;
color: #ff0000;
position: absolute;
top: 0px;
left: 30px;
visibility: visible;
z-index: 1;
}

.desc {
text-align: center;
font-family: Arial, Helvetica;
color: #cc6699;
position: absolute;
top: 220px;
left: 40px;
width: 400px;
visibility: hidden;
z-index: 0;
}
</style>
<script type="text/javascript" language="JavaScript">


/* Show an object */
function showObject(object) {
object.visibility = VISIBLE;
}

/* Hide an object */
function hideObject(object) {
object.visibility = HIDDEN;
}

/* Slide the company logo from top to middle */
function slideLogo(from, to) {
if (from < to) {
company.top = (from += 10);
setTimeout('slideLogo(' + from + ',' + to + ')', 75);
}
else initObjects();
}

/* Rotate selected objects */
function rotateObjects() {
for (var i = 0; i < pos.length; i++) {
pos[i] += inc; objects[i].visibility = 'visible';
objects[i].left = (r * Math.cos(pos[i])) + xoff
objects[i].top = (r * Math.sin(pos[i])) + yoff;
}
rotateTimer = setTimeout("rotateObjects()", 75);
}

/* Initialize selected objects for rotation */
function initObjects() {
/* Here is the array of HTML elements that will be rotated, from fly1 to fly4
Just put the shortcut variables to the HTML elements in this little array
and they will be rotated automatically */
objects = new Array(fly1, fly2, fly3, fly4);
pos = new Array();
pos[0] = 0;
for (var i = 1; i < objects.length; i++) {
pos[i] = parseFloat(pos[i - 1] + ((2 * pi) / objects.length));
}
rotateObjects();
}

/* Variables for rotating objects */
var objects;
var pos;
var r = 160; // radius
var xoff = 180; // x offset
var yoff = 170; // y offset
var pi = Math.PI; // get pi
var inc = pi / 180; // degrees per rotation cycle
var objects; // objects to be rotated
var pos; // position for objects

</script>

<SCRIPT LANGUAGE="JavaScript">

<!--
function exit(url) {
if (window.name == "") {
top.location.href = url;
} else {
top.opener.top.location.href = url;
top.close();
}
}
//-->

</SCRIPT>
</head>
<body bgcolor="#ffe4c4" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<div id = "fly1" class = "fly">
<a href = "contents.htm" onMouseOver = "showObject(desc1)" onMouseOut = "hideObject(desc1)">Introduction</a><br>
</div>
<div id = "fly2" class = "fly">
<a href = "navigationaids.htm" onMouseOver = "showObject(desc2)" onMouseOut = "hideObject(desc2)">Navigation Aids</a><br>
</div>
<div id = "fly3" class = "fly">
<a href = "coloursandgraphics.htm" onMouseOver = "showObject(desc3)" onMouseOut = "hideObject(desc3)">Colours and Graphics</a><br>
</div>
<div id = "fly4" class = "fly">
<a href = "funstuff.htm" onMouseOver = "showObject(desc4)" onMouseOut = "hideObject(desc4)">Fun Stuff</a><br>
</div>
<div id = "company" class = "logo">Barname nevis </div>
<div id = "desc1" class = "desc">
Introduction and links
</div>
<div id = "desc2" class = "desc">
Aids to Web site navigation
</div>
<div id = "desc3" class = "desc">
Playing with colours and images
</div>
<div id = "desc4" class = "desc">
Games, quizzes, etc.
</div>
<script type="text/javascript" language="JavaScript">

/* Simple version detection */
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);

/* They can be used in place
of hidden and visible because on occasion Navigator has problems with the two */
var HIDDEN = (isNS) ? 'hide' : 'hidden';
var VISIBLE = (isNS) ? 'show' : 'visible';

/* Create shortcut variables for different absolutely positioned elements */
var fly1 = (isNS) ? document.fly1 : document.all.fly1.style;
var fly2 = (isNS) ? document.fly2 : document.all.fly2.style;
var fly3 = (isNS) ? document.fly3 : document.all.fly3.style;
var fly4 = (isNS) ? document.fly4 : document.all.fly4.style;
var company = (isNS) ? document.company : document.all.company.style;
var desc1 = (isNS) ? document.desc1 : document.all.desc1.style;
var desc2 = (isNS) ? document.desc2 : document.all.desc2.style;
var desc3 = (isNS) ? document.desc3 : document.all.desc3.style;
var desc4 = (isNS) ? document.desc4 : document.all.desc4.style;

/* Begin the sliding of the company logo */
slideLogo(0, 140);
</script>
<div id="footer+text" style="position: absolute; left:200; top: 370"><layer name="footer+text" left=200 top=370><form>
<input type=button value="Close Window" onClick="exit('fly.htm');">
</form> </layer></div>
</body>
</html>

</body>

</html>
خوبه یا نه

nasr
دوشنبه 21 اردیبهشت 1383, 20:44 عصر
فکر می کنم

اگه هر کدوم از این موضوعات را در یک تاپیک جدا بگذاریم بهتر باشه

چون اینطوری خیلی صفحه طولانی می شه

درسته

ehsan-ets
دوشنبه 21 اردیبهشت 1383, 21:04 عصر
خیلی خوبه ولی اگر اینا رو به صورت جدا جدا و دستاه بندی شده...
:wink:

nasr
دوشنبه 21 اردیبهشت 1383, 23:11 عصر
به روی چشم