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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.