www.webdeveloper.com
Results 1 to 2 of 2

Thread: Change height of textarea field.

  1. #1
    Join Date
    Nov 2008
    Posts
    1

    Change height of textarea field.

    Hello, I am a new programmer and I am having trouble with a javascript lesson that I am working on. The problem I am having is in line 17 of the following code:
    top.frames[1].frames('code2').forms("code").document.getElementById("inputcss").style.height="300px"
    Code:
    <html>
    <head>
    
    <title>Web Design Demo Control Buttons</title>
    <link href="title.css" rel="stylesheet" type="text/css" />
    
    <script  src=""  type="text/javascript"></script>
    
    <script type="text/javascript">
    
    	function showPreview(){		
    		top.document.getElementById("demo").rows="100,*,1"
    		}
    
    	function showCode(){
    		top.document.getElementById("demo").rows="100,1,*"
    		top.frames[1].frames('code2').forms("code").document.getElementById("inputcss").style.height="300px"
    		}
    	function showBoth(){
    		top.document.getElementById("demo").rows="100,210,*"	
    		}		
    </script>
    
    
    </head>
    
    <body>
    <form name="control" id="control" action="">
    
    <h2 id="demotitle">Creating Web Pages</h2>
    <p>
       <input type="button" value="Submit Code" onclick='sendCode()' >
       <input type="button" value="Show Only Code" onclick='showCode()' >
       <input type="button" value="Show Only Preview" onclick='showPreview()' >
       <input type="button" value="Show Code and Preview" onclick='showBoth()' >
    </p>
    </form>
    </body>
    </html>
    The parent code is:
    Code:
    <html>
    <head>
    
    
    <title>HTML Demo</title>
    </head>
    
    <frameset rows="100,210,*" id="demo" name="demo"> 
       <frame name="title" id="title" src="title.html" scrolling="no" />
       <frameset cols="*,*">
          <frame name="code1" id="code1" src="html.html" />
          <frame name="code2" id="code2" src="css.html" />
       </frameset>
       <frame name="output" id="output" />
    </frameset>
    
    </html>
    and the final page where the attribute I am changing is:
    Code:
    <html>
    <head>
    <!-- 
       New Perspectives on JavaScript
       Tutorial 6
       Case Problem 3
    
       CSS Code for the Demo Page
    
       Filename:         css.html
       Supporting files: code.css
    
    -->
    <title>CSS Code for the Demo Page</title>
    <link href="code.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form name="code" id="code" action="">
    <p>
    &lt;style type="text/css" &gt;
    <textarea id="inputcss" name="inputcss"></textarea>
    &lt;/style&gt;
    </p>
    </form>
    </body>
    </html>
    The problem is that the line does not properly address the attribute probably because of an incorrect DOM statement. This is my first statement that is this deep. The statement before it works fine. I have been working on this for hours but I do not seem to be able to come up with the correct statement.
    Can someone please help me to correct this line of code so it works. I Have much more code to write and if I can get this statement worked out I can finish this assignment and I should know how to properly move through the DOM.

    Thank you.
    Last edited by waltapp; 11-11-2008 at 07:18 PM.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,666
    Code:
    top.frames[1].frames['code2'].document.forms['code'].elements['inputcss'].style.height="300px";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles