CygnusKnight
CygnusKnight

Reputation: 87

Javascript to set noResize attribute for frame

I have a frameset like this:

<frameset id="main_frame" cols="20%,80%" frameborder="1">   
    <frame id="frame1" name="frame1" src="frame1.html">
    <frame id="frame2" name="frame2" src="frame2.html">
</frameset>

In frame 1, I have:

<body onload="enableNoResize()">
</body>

And the js function is:

function enableNoResize() {
    var frame = parent.frames['frame1'] || parent.document.getElementById('frame1');
    frame.noResize = "true";
}

When debugging using firebug or chrome, I found that, the js function was gone through but no affect. The frame is still resizable. I tested in chrome 16, firefox 8, IE 9.

How can I make it work? Is anything wrong in my code?

Upvotes: 0

Views: 920

Answers (2)

Teemu
Teemu

Reputation: 23416

If the frameset is in browser's top.window, try top.window instead of parent.

Upvotes: 0

Axel Guckelsberger
Axel Guckelsberger

Reputation: 86

I did not test it, but please try:

frame.setAttribute('noResize', true);

Upvotes: 1

Related Questions