...

View Full Version : Variable to be used in href



geekyvirgin
07-14-2010, 11:03 AM
Please check out the code and tell me how can i use the variable as a href link.

var rand_link = new Array ();
rand_link[0]="asdhrfe22k";
rand_link[1]="iqh3wjhs8s";
rand_link[2]="snbds7s8h3";
rand_link[3]="=jh99shhs99";
rand_link[4]="shdbfh3h83";

var rand = Math.floor(5 * Math.random());

var ref = rand_link[rand];

document.write("<a href=http://www.youtube.com/watch?v= [with the variabel "ref"]>Click here</a>");

where, the array of links are in rand_link.

Candan
07-14-2010, 11:07 AM
doucment.write("<a href='http://youtube.com/"+ ref +"'>Click here!</a>");

geekyvirgin
07-14-2010, 11:36 AM
Candan, thank you for your help .. It worked



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum