views:

1057

answers:

1

Hey everyone,

I have a frameset with it's cols attribute set to "50%,50%" at the moment. I have a toggleView method which is called after a click on an element.

What I aim to do is to change frameset from displaying cols to rows, again divided 50/50.

I have attempted to perform a removeAttribute("cols") on the frameset, while this does remove the "cols" attribute, it doesn't seem to update on the page (testing live using firebug).

I would then go on to add a rows attribute (is createAttribute and then setAttribute a valid method to do this?) in order to complete the switch.

I'm wondering if this is even feasible seeing as removing the columns does not seem to do anything.

Many thanks for any help.

+1  A: 

This worked fine for me:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"&gt;
<html>
  <head>
    <title>A simple frameset document</title>
    <script type="text/javascript">
      function onloadHandler() {
        setTimeout(function() {
          var myFrameset = document.getElementById("myFrameset");
          var value = myFrameset.getAttribute("cols");
          myFrameset.removeAttribute("cols");
          myFrameset.setAttribute("rows", value);
        }, 2500);
      }
    </script>
  </head>
  <frameset id="myFrameset" onload="onloadHandler()" cols="50%, 50%">
    <FRAME src="page1.htm">
    <FRAME src="page1.htm">
  </frameset>
</html>

Basically, it swaps 2.5 seconds after the page loads. Let me know if you need anything else or if this doesn't work for some reason for you. I tested it only in IE7 (which is what I have been developing an application for lately, unfortunately).

Jason Bunting
hey man. Thanks for answering. I actually got it working right before I went home and before your answer came.Did something very similar, turns out setting the cols attribute to an empty string has the same effect as removing it. So added a rows attribute and did that. Used JQuery. Thanks again.