Archive

Posts Tagged ‘ads’

Vertical Marquee Banner

September 27, 2008 ppshein Leave a comment

I was supposed to create randomize rotated ads banner with javascript. But it’s not quite alright and not have enough performance to all browsers. That’s why I considered to do this small function with old-fashioned coding which is <marquee> tag. Because we shouldn’t stick in attemption for serveral times when we’re solving and finding bugs. That’s why I decided to do with marquee tag and save my time. It’s quite easy and flexiable to all browser but it’s awful that before page is completely loaded by browser if banners images are more than 10 images.

<marquee direction=”up” onmouseover=”this.stop()” onmouseout=”this.start()” scrollDelay=”200″ width=”200″>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/flexanew” target=”_blank”><img src=”misspeople_sponsors/platinum_1.jpg” id=”adBanner1″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/alpine” target=”_blank”><img src=”misspeople_sponsors/platinum_2.jpg” id=”adBanner2″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/silk-n-shine” target=”_blank”><img src=”misspeople_sponsors/platinum_3.jpg” id=”adBanner3″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/perfectil” target=”_blank”><img src=”misspeople_sponsors/platinum_4.jpg” id=”adBanner4″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/smooth-e” target=”_blank”><img src=”misspeople_sponsors/platinum_5.jpg” id=”adBanner1″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/lily” target=”_blank”><img src=”misspeople_sponsors/platinum_6.jpg” id=”adBanner2″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/ogawa” target=”_blank”><img src=”misspeople_sponsors/platinum_7.jpg” id=”adBanner3″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/dodokoko” target=”_blank”><img src=”misspeople_sponsors/platinum_8.jpg” id=”adBanner4″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/vista” target=”_blank”><img src=”misspeople_sponsors/platinum_9.jpg” id=”adBanner1″ border=”0″ alt=”ad banner” /></a>
<a href=”http://www.planet.com.mm/advfile.cfm/adv/tri” target=”_blank”><img src=”misspeople_sponsors/platinum_10.jpg” id=”adBanner2″ border=”0″ alt=”ad banner” /></a>
</marquee>

Categories: Javascript, html Tags: , ,

Random Image Rotator

September 18, 2008 ppshein Leave a comment

I was kinda busy in these days about creating misspeople page of myanmar people magazine. In this page, we need to show our client adversitements as rotator. Do you know how to rotate ADS?

<SCRIPT LANGUAGE=”JavaScript”>
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

 var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem(“01.jpg”);
image_list[image_index++] = new imageItem(“02.jpg”);
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}

function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}

function generate(x, y) {
var range = y – x + 1;
return Math.floor(Math.random() * range) + x;
}

function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}

var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}

function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = “rotateImage(‘”+place+”‘)”;
setTimeout(recur_call, interval);
}
//  End –>

</script>
</HEAD>

<center>
<img name=”rImage” src=”01.jpg” width=120 height=90>
</center>

<script>
<!– 
rotateImage(‘rImage’)?
 –>
</script>

Categories: Javascript Tags: , ,