I know there a quite a few of these on google but, either im not searching correctly, or they dont do what I want. I feel what I want is very simple, but I know pretty much nothing about javascript.

I want to create a loop through the entire linking code and image for example:
<a href="#" title="" target=""><img src="image.jpg" title="" style=""/></a>

The ones that I find, splits the link up with from the image and doesnt give you the option to add a target, title , styling, class and so on..

I did this in school many years ago but I cannot remember how to do it.

I would like it to load a new banner on every page load and just keep my code together instead of splitting it up.

And lastly, I cannot use PHP. So it has to be HTML javascript

Any links to tutorials or code help would be great,
Thanks,
Brian

Maybe hope them into an array and randomize the output.

Something like this:

<script>
var myBanners = new Array();
myBanners[0] = "<a href='http://www.google.com' title='' target=''><img src='http://t3.gstatic.com/images?q=tbn:ANd9GcT58Sipb4ybV04mhSzNJgf1B7-B74OA32Z7XbVpWFuqvph2vTcdjA' title='' style=''/></a>";
myBanners[1] = "<a href='http://www.yahoo.com' title='' target=''><img src='http://t0.gstatic.com/images?q=tbn:ANd9GcRlTJvOz-tpi7jkfiN-037-Otqep8uJThTD45t8oZsrZnrzgcYt' title='' style=''/></a>";
myBanners[2] = "<a href='http://www.bing.com' title='' target=''><img src='http://t3.gstatic.com/images?q=tbn:ANd9GcRdDitGpwebZ50L-J6nAf2IUvPpmVLhncGp8UyJzdzTACaxrQxFFA' title='' style=''/></a>";

document.write(myBanners[Math.floor(Math.random()*3)]);
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.