millercj Posted March 1, 2008 Share Posted March 1, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.