Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE write to layer

Status
Not open for further replies.

michelledebeer

Programmer
Oct 26, 2001
22
SE
I want to update a layer without reloading the page.

I have previously recieved this function, but it only works with Netscape.

How can I make it work for IE?

function print_picture(picture) {
with(document.layers['myLayer']) {
document.open();
document.write('<img src=&quot;'+picture+'&quot;>');
document.close();
}
}

// Michelle
 
depending on how your page is set up, I might suggest different things. what about showing us your html code? --------------------------------------------------
Goals are dreams with deadlines
 
Layers is for netscape. cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
Yep, Chris, that's why I asked her for the html to see what she's got to work with IE. --------------------------------------------------
Goals are dreams with deadlines
 
Oops, sorry for being to short.
I want to print it to the <div>-tag...

This is the html code:

<html>
<title>Swap Images</title>
<head>
<script>
function print_picture(picture) {
with(document.layers['myLayer']) {
document.open();
document.write('<img src=&quot;'+picture+'&quot;>');
document.close();
}
}
</script>
</head>

<body>
<a href=&quot;javascript:print_picture('picture1.gif')&quot;>Picture1</a>
<a href=&quot;javascript:print_picture('picture2.gif')&quot;>Picture2</a>

<div id=&quot;myLayer&quot; style=&quot;position:absolute; left:64px; top:54px; width:200px; height:165px&quot;>
</div>

</body>
</html>
 
in that case, jared gave you a perfect responce in your other thread. --------------------------------------------------
Goals are dreams with deadlines
 
in IE, you set
Code:
document.all.myLayer.innerHTML
to be a string using the &quot;=&quot; operator. It is much faster and easier (not to mention, more dynamic) than Netscape's methods.

Code:
document.all.myLayer.innerHTML='<img src=&quot;'+picture+'&quot;>';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top