برامج

كود تغيير البنر مع كل تحديث للصفحة [الأرشيف] - برامج نت

المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : كود تغيير البنر مع كل تحديث للصفحة


haiman
12-23-2007, 01:54 PM
السلام عليكم اخوانى

اليوم سوف اعرض عليكم كود متواضع وهو تغير صورة البنر مع كل عمل تحديث للصفحة

بمعنى

ان كل عضو وهو ينتقل من صفحة الى اخرى يتغير البنر ويظهر واحد جديد انت تضعه من مجموعة مختارة له

وهذا مثال على ذلك

http://ourpetclub.com/vb/uploaded/10_banndaaaaa.jpg

اضغط هنا لترى المثال (http://www.ourpetclub.com/vb)
شرح طريقة التركيب



اولا اخوانى لابد ان يكون المنتدى ثابت العرض اى 800 بيكسل

لاننا فى هذه الطريقة لا نستطيع ان نعمل منطقة تمدد بهذه الطريقة والصورة توضح ذلك

نقوم بوضع الكود فى المكان المخصص بوضع الصورة القديمة فى البنر

theImages[0] = 'http://ourpetclub.com/vb/images/banner/bird.jpg' // replace with names of images

نقوم بتغير مسار الصورة فى الاسطر الموجوده هذه واذا اردنا ان نضيف عدد اكبر من الصور نقوم بزيادة الاسطر به



<****** LANGUAGE="Java******">

var theImages = new Array()

//Random-loading images

theImages[0] = 'http://ourpetclub.com/vb/images/banner/bird.jpg' // replace with names of images

theImages[1] = 'http://ourpetclub.com/vb/images/banner/bird1.jpg' // replace with names of images

theImages[2] = 'http://ourpetclub.com/vb/images/banner/cat2.jpg' // replace with names of images

theImages[3] = 'http://ourpetclub.com/vb/images/banner/catdi.jpg' // replace with names of images

theImages[4] = 'http://ourpetclub.com/vb/images/banner/dogcat.jpg' // replace with names of images

theImages[5] = 'http://ourpetclub.com/vb/images/banner/fss.jpg' // replace with names of images

theImages[6] = 'http://ourpetclub.com/vb/images/banner/tiger.jpg' // replace with names of images

var j = 0

var p = theImages.length;

var preBuffer = new Array()

for (i = 0; i < p; i++){

preBuffer[i] = new Image()

preBuffer[i].src = theImages[i]

}

var whichImage = Math.round(Math.random()*(p-1));

function showImage(){

if(whichImage==0){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==1){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==2){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==3){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==4){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==5){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==6){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

else if(whichImage==7){

********.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');

}

}

</******>

<******>showImage();</******>





ارجوا ان ينال الكود اعجابكم

وسامحونى اذا كان مكرر