Jump to content

Send Variable Contents to Div


millercj

Recommended Posts

I'm trying to generate a random image (rendered from an external .js) and pass it into a <div> on the page.

This is the code i have but i cannot get it into the div...any ideas?

 

<script type="text/javascript">
var rand_no = Math.ceil(Math.random() * 5);
var imageCode='<img src="'+ rand_no+ '.gif" alt="" height="10" width="10" border="0">';
document.getElementById('main').innerHTML =imageCode;
</script>

Link to comment
https://forums.phpfreaks.com/topic/93894-send-variable-contents-to-div/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.