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

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


haiman
12-23-2007, 04:46 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
نقوم بتغير مسار الصورة فى الاسطر الموجوده هذه واذا اردنا ان نضيف عدد اكبر من الصور نقوم بزيادة الاسطر به

<SCRIPT LANGUAGE="JavaScript">
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){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==1){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==2){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==3){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==4){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==5){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==6){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
else if(whichImage==7){
document.write('<a href ="index.php"><img src="'+theImages[whichImage]+'" border=0 width=790 height=180></a>');
}
}
</script>
<script>showImage();</script>


ارجوا ان ينال الكود اعجابكم
وسامحونى اذا كان مكرر

تــ ح ـــبكrooh
12-23-2007, 11:56 PM
مشكور والله يعطيك العافيه

كود جميل ^,^

Divianella
12-24-2007, 12:10 AM
ماشاء الله فعلا سهل و بسيط و مفهوم
مشكور أخى والله على الكود
تم تجربته بنجاح :showoff:

haiman
12-26-2007, 08:52 AM
مشكور والله يعطيك العافيه

كود جميل ^,^

تشكر اخى على المرور
جزاك الله كل خير

ماشاء الله فعلا سهل و بسيط و مفهوم
مشكور أخى والله على الكود
تم تجربته بنجاح :showoff:

تسلم اخى
ومرحبا بك معنا فى المنتدى