views:

24

answers:

1

I'm using a small CMS for a small site (http://www.ovlu.li/cms/). There I include a JavaScript on the first site to open an image in a popup:

<script type="text/javascript">
function pop(file)
{
helpwindow = window.open(file, "Vaterland", "width=600, height=796",  "directories=no", "toolbar=no", "location=no", "status=no", "menubar=no", "resizable=no");
helpwindow.focus();
return false;
}
</script>

This works fine in FireFox, Chrome and Safari, but unfortunately, in Internet Explorer this script totally destroys the layout of the site where it is contained. Nevertheless it works. And all other sites are also working correctly. Any hints?

+2  A: 

I think your main problem is that the script is located before <html>. It should be inside of <head>.

Other than that, your javascript is wrong. The third parameter is features. Instead, you're passing features as a heap of paramters, divided. see window.open reference

This is what it should like:

window.open(file, "Vaterland", "width=600, height=796, directories=no, 
    toolbar=no, location=no, status=no, menubar=no, resizable=no");

(line break added for readability. not to be included in final code)

... but this last remark is not what's causing your layout issues. If you're sure it's all because of the script, then it's because it's placed outside of <html>

David Hedlund
Thanks for your answer! I placed the script inside the body tag (that's not really a problem, right??) and know it works perfectly well. Then I'll try to change the script as you suggested. Thanks!
Roflcoptr
@Sebi: putting the script block inside body is not perfectly valid, but it won't cause any rendering issues. all browsers support it, and there are cases when it's even recommended.
David Hedlund
Ok thanks a lot, then I will leave it their until I found a way how to put it in the head tag using the CMS.
Roflcoptr