Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,832 members, 7,813,775 topics. Date: Tuesday, 30 April 2024 at 06:05 PM

simple ad Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / simple ad Code (1112 Views)

Facebook And Instagram Ad Issues / Use Your Internet As A Text Editor Without Any Ad-on Or Pluggin / Review My Classified Ad Android App (2) (3) (4)

(1) (Reply) (Go Down)

simple ad Code by Nobody: 6:18pm On Sep 26, 2015
<language="JavaScript">
images = new Array(3);
images[1] = "<a href ='nerdslot.com'
rel='nofollow' ><img
src='http://imagizer./img661/7543/BJ28kI.jpg' border='0'
height='60px' width='468px'
alt='tech blog'>";
index = Math.floor
(Math.random() *
images.length);
document.write(images
[index]);
</img
src='http:></a></language="javascript">
Re: simple ad Code by Nobody: 6:36pm On Sep 26, 2015
It is a simple java ad code . The ad code i wrote is not redirecting to the target destination
Re: simple ad Code by Nobody: 7:06pm On Sep 26, 2015
The url suppose to be http://www.nerdslot.com but the ads is not neat and errors in html code
Re: simple ad Code by Craigston: 8:37pm On Sep 26, 2015
Check your JavaScript console for error logs.
This line
 index = Math.floor (Math.random() * images.length); 
does something interesting. Read up a reference on it. It generates a random number from 0.1 to 1. You multiply that number by another number and you get a number greater than zero and less than or equal to the second number. You pass the result to the
floor()
method of the
Math
object and you get a value rounded to the lower nearest integer.
So your program likely does not return '1' which is the length of your array. It is written to return a random number. Let us say it goes this way.
Math.floor(Math.random() * index.length)
//assuming index.length = 1
//assuming Math.random() returns 0.25
//the operation Math.random() * index.length returns 0.25, which is passed to the floor() method of the Math object.
//Math.floor(0.25) rounds the returned value (0.25) to the lower nearest integer. That means it returns 0.
//now, images[0] in your program is "undefined"

1 Like

Re: simple ad Code by Nobody: 3:23pm On Sep 27, 2015
Craigston:
Check your JavaScript console for error logs.
This line
 index = Math.floor (Math.random() * images.length); 
does something interesting. Read up a reference on it. It generates a random number from 0.1 to 1. You multiply that number by another number and you get a number greater than zero and less than or equal to the second number. You pass the result to the
floor()
method of the
Math
object and you get a value rounded to the lower nearest integer.
So your program likely does not return '1' which is the length of your array. It is written to return a random number. Let us say it goes this way.
Math.floor(Math.random() * index.length)
//assuming index.length = 1
//assuming Math.random() returns 0.25
//the operation Math.random() * index.length returns 0.25, which is passed to the floor() method of the Math object.
//Math.floor(0.25) rounds the returned value (0.25) to the lower nearest integer. That means it returns 0.
//now, images[0] in your program is "undefined"




thanks I will try it later
Re: simple ad Code by Nobody: 1:49pm On Sep 28, 2015
<script> language="JavaScript"> images = new Array(3); images[0] = "<a href = 'URL OF ADVERTISER ' rel='nofollow' ><img src=' URL OF BANNER’S IMAGE ' border='0' height='60px' width='468px' alt=' AD DESCRIPTION' ></ a>"; index = Math.floor (Math.random() * images.length); document.write(images [index]); </script>
Re: simple ad Code by Craigston: 10:50pm On Sep 29, 2015
proxy20:
<script>
language="JavaScript">
images = new Array(3);
images[0] = "<a href = 'URL
OF ADVERTISER '
rel='nofollow' ><img
src=' URL OF BANNER’S
IMAGE ' border='0'
height='60px' width='468px'
alt=' AD DESCRIPTION' ></
a>";
index = Math.floor
(Math.random() *
images.length);
document.write(images
[index]);
</script>
Does it now work?
Re: simple ad Code by Nobody: 7:00am On Sep 30, 2015
I am using this code <a href=" TARGET URL " target="_blank"><img border="0" src=" IMAGE URL " width="300px" height="250px"/></a>
Re: simple ad Code by Nobody: 7:01am On Sep 30, 2015
Craigston:
Does it now work?
yes, it works

(1) (Reply)

App Developer Wanted / Best Adsense Alternative / I Need An Affordable Webdesigner

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.