image is not displaying when i write image code in document.write()

Posted by Rickeybglr under ASP.NET on 11/8/2011 | Points: 10 | Views : 3607 | Status : [Member] | Replies : 5
where i am doing wrong:
<script type="text/javascript">
function open_win() {
var win = window.open('home.aspx');
win.document.write('<div');
win.document.write('<img src="../Images/scene.gif">' +'</br>'+'Loading...');
win.document.write('</div>');

image location .."../Images/
image name=scene.gif




Responses

Posted by: Blessyjees on: 11/8/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Why you didn't add this code in home.aspx. Add this code in that page and try.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
no that's my requirement..actually i ma trying to show image, when client send the request

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: BlueDotBliss on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
I am working on the same thing today, and am also having problems getting the image to load in the document.write(). The loading message is working fine, and I even moved my image down into the html (out of the javascript) just to make sure it was formatted correctly, and it is.

It's not the end of the world, because at least the "Loading..." message is displayed when the page is loading, but I wanted the animated loading image to be displayed also. I hope someone has an answer to this problem.

Carrie

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: BlueDotBliss on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
Okay, my problem was because the html in the document.write() was not spaced correctly.

Your code seems to have some syntax errors:

1. The </br> you have should really be <br /> instead.
2. Your opening <div> is missing the ">" at the end.
3. Your <img> is missing the "/" from the closing tag. You have <img src="../Images/scene.gif"> but it should be <img src="../Images/scene.gif" />
4. The <img> is also missing the required "alt" attribute. You could format it like <img src="../Images/scene.gif" alt="Scene Image" /> but something needs to go there.

Let me know if these things fix your problem.

Carrie

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
@BlueDotBliss
hey thnx...but that problem is bcoz of browser compatible issue. now its working fine.


Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response