Jump to content

conditional statement


Recommended Posts

I have a simple script to chose an image from an array to use as the image on a page. Some are .gif but some are .swf filetypesThese have to be loaded separatley. All image formats work fine but i have problems with the .swfIn the following code if i make the "if = 4" the swf displays correctly but all the time as it is an assignment statement. But making it "if == 4" as a comparisson the swf then doesnt display at all. Why not :S ??

var imgPicArray = new Array("chesters.gif", "moira.gif", "sussexd.gif", "eastbourneapartments.swf");var imgLinkArray = new Array("http://www.chesterseastbourne.com", "http://www.moirahouse.co.uk", "http://www.sussexdowns.ac.uk", "http://www.eastbourneapartments.com");var imgValue = Math.floor(Math.random()*4);var imageFileSelection = imgPicArray[imgValue];var imageUrl = imgLinkArray[imgValue];var imgData ="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='100' height='100'><param name='movie' value='sponsors/eastbourneapartments.swf'><embed src='sponsors/eastbourneapartments.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100' height='100'></embed></object>";if (imgValue==4) { document.write(imgData);}else {document.write("<A href =",imageUrl," target='_blank'><IMG SRC =\sponsors/",imageFileSelection,"></a>");}

what am i doing wrong?thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...