Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reloading div dynamically

 
Bhavin Sanghani
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Based on user's selection, I want to show image(s) in particular div. I tried innerHTML and style.display = "". But this does not dynamically shows images in div.

Also, can we reload particular div after placing image in that using innerHTML?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64978
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bhavin Sanghani:
I tried innerHTML and style.display = "". But this does not dynamically shows images in div.
Why would you think that would work? Try "block".

Also, can we reload particular div after placing image in that using innerHTML?
Yes.
 
Bhavin Sanghani
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can it be done?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64978
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which part? What code have you written so far?
 
Bhavin Sanghani
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying following code. calling dropit() function onclick of image to show it in particular area of the page.


function dropit(imageName)
{

document.getElementById("container").style.display = "block";
document.getElementById("container").innerHTML = "<br><img src='" + imageName + "/>";
}


<table border="0">
<tr>
<td>
<tr>
<td align="center" valign="middle">
<div style="display:none;" id="container">

</div>
</td>
</tr>
</td>
</tr>
</table>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic