This assignment works with frames on a page using Javascript. Specifically, the page is a demonstration page where you type code in the left window and after clicking a corresponding button, the result shows up in the right window respectively.
I'm having some difficulty with my showCode() function I created. The purpose of this function is to hide the preview frame and to increase the size of the textarea fields in the html.htm and css.thm documents that I have with me. Here are the steps for this code:
Code: Select all
1. Set the value of the demo frameset's row attribute to "100,*,1" (the frameset's ID is "demo" btw).
2. Change the height of the textarea field in the html.htm file to 300 pixels (There's a hint given that I have to move up to the parent object and then down to the second frame in the frames collection to reference the contents of the html.htm document. I'm then to use the document.getElementById() method to reference the textarea field and use the style.height property to set the textarea field's height to 300 pixels.)
3. Change the height of the textarea field in the css.htm file to 300 pixels also. css.htm is the third frame of the frames collection.
So, this is what I came up with:
function showCode(){
parent.document.getElementById("demo").rows = "100,*,1";
parent.frames[1].document.getElementById("inputhtml").textarea.style.height = "300px";
parent.frames[2].document.getElementById("inputcss").textarea.style.height = "300px";
}
So I'm getting the "null or not an object" error message for the first line. Where am I going wrong?
Thanks,
Trellot