Javascript DOM Opera vs IE

Z

zeljko.markic

Strangely I came acros a problem in IE performing little asp/javascript
model:

code:
<script type="text/javascript">
function turn_on_files(folder)
{
x=event.clientX+25
y=event.clientY+25
document.getElementById('files_frame').style="visibility:visible;z-index=9;position:absolute;left:"+x+"px;top:"+y+"px;";
document.getElementById('files_frame').src="http://www.somesite.com/chart.asp?width=300&height=240&charttype=line&name="+folder;
}
function turn_off_files()
{
document.getElementById('files_frame').style="visibility:hidden;z-index=9;position:absolute";
}
</script>

......

<iframe id=files_frame
src="http://ratool.win.vipnet.hr/chart.asp?width=300&height=240&charttype=line&name=tapin_udr"
width=300 height=240 frameborder=0 marginheight=0 marginwidth=0
scrolling=no
style="visibility:hidden;z-index=9;position:absolute;left:50px;top:20px;"></iframe>

.......
<div onmouseover=turn_on_files("some_text")
onmouseout="turn_off_files()"><img src=images/red_dot_blink.gif></div>



This works fine in Opera, but in IE I get strange error:
Permisssion denied: line 11 or line 17
when i trigger this event...
line 11 or 17 are "document.getElementById('files_frame').style" lines
in javascript...
 
M

Martin Honnen

document.getElementById('files_frame').style="visibility:visible;z-index=9;position:absolute;left:"+x+"px;top:"+y+"px;";

The style property is an object with individual properties for the CSS
properties so you need to do
var element = document.getElementById('files_frame');
element.style.visibility = 'visible';
element.style.zIndex = '9';
element.style.position = 'absolute';
and so on for all the properties you want to set.
 
Z

zeljko.markic

Martin said:
The style property is an object with individual properties for the CSS
properties so you need to do
var element = document.getElementById('files_frame');
element.style.visibility = 'visible';
element.style.zIndex = '9';
element.style.position = 'absolute';
and so on for all the properties you want to set.

Thanx, this solved my problem! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top