...

View Full Version : help with if/then



alimagik
12-16-2006, 02:42 PM
I started writing my very first javascript, but I've hit a wall. So far I have:


<script language="JavaScript" type="text/JavaScript">
var link_list=new Array()
link_list='<a href="http://www.cafepress.com/ultrageek/1335410/?pid=2489903">Astonomers Do It</a><br>'+
'<a href="http://www.cafepress.com/ultrageek/1335423/?pid=2489903">Astrophysicists Do It</a><br>'+
'<a href="http://www.cafepress.com/tvtee/1168647/?pid=2489903">Australians Do It </a><br>'+

'<a href="http://www.cafepress.com/ultrageek/1439447/?pid=2489903">Biologists Do It</a><br>'+
'<a href="http://www.cafepress.com/ultrageek/1439455/?pid=2489903">Botanists Do It</a><br>'+
'<a href="http://www.cafepress.com/niftetees/1406587/?pid=2489903">Bowlers do it </a><br>'+
'<a href="http://www.cafepress.com/tvtee/1168670/?pid=2489903">Bowlers do it </a><br>'+
</script>



<script language="JavaScript" type="text/JavaScript">
function affiliate_sidebar(){
document.write(link_list)
}
affiliate_sidebar()
</script>

Now all I have to do is figure out how to have some default links displayed if there are none specified in var link_list. I thought maybe something along the lines of "if var link_list is undefined", but I don't have a clue if that would actually work or how to write it.

Thanx in advance!

whizard
12-16-2006, 05:03 PM
function affiliate_sidebar()
{
if (link_list.length < 1)
{
//Show default links/text
}
else
{
document.write(link_list)
}
}


HTH
Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum