javascript code works for a little while

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

The code below opens the window and displays the image as a quick flash then
the image goes away and is replaced by a small icon.



Got any idea how to fix it?

thanks



function openWindow(name, path, w, h){

tmpTitle='title'

OpenWindow=window.open(
path,name,'location=0,resizable=1,width='+w+',height='+h);

OpenWindow.document.write('<html><head><'+tmpTitle+'>'+name+'</'+tmpTitle+'>');

OpenWindow.document.write('<link rel="stylesheet" href="style.css">');

OpenWindow.document.write('</head><body>');

OpenWindow.document.write('<p> <img ImageUrl="' + path+ '" /></p>');

OpenWindow.document.write('</body></html>');

OpenWindow.document.close();

}
 
try to replace ImageUrl with src
so instead of
OpenWindow.document.write('<p> <img ImageUrl="' + path+ '" /></p>');
it will be
OpenWindow.document.write('<p> <img src="' + path+ '" /></p>');

there is not such thing as ImageUrl in HTML.

George.
 
thanks, that fixed it. I got the code from the Internet. After the last line
"close" there was another line:

self.name="main"

I read the help but couldn't figure what it was for. Do you know? Should I
put it back?

thanks again
 
my guess this assigns name 'main' to the main window. So later child window
could refer to it by that name.
but you do not need it...

George.
 
thanks
George said:
my guess this assigns name 'main' to the main window. So later child
window could refer to it by that name.
but you do not need it...

George.
 
BTW. See how I handled <title>
If I use <title> </title> I get the error message that I can only have one
title

Are you familiar with that?

thanks again
 
Not sure where are you getting error message from...
Probably from Visual Studio..and it's not an error message it's probably a
warning...
Just ignore it... or disable validation of HTML altogeter... menu
Tools/Options/Validation...

George.
 
Back
Top