更改嵌套框架中textarea字段的高度 [英] Change height of textarea field in nested frame
问题描述
您好,我是一名新程序员,我正在开展一个学校项目。我被指示向上移动然后向下移动。我的父亲是demo.html然后是一个框架集,然后是框架集中的另一个框架集。我已经弄清楚如何到达父级,然后到第一个框架集并更改rows属性。但是我坚持到了下一个级别,我需要将第二个框架集textarea的高度更改为300像素。
这里是demo.html的代码
[HTML]< html>
< head>
<! -
关于JavaScript的新观点
教程6
案例问题3
网页设计演示
文件名:demo.html
支持文件:css.html,html.html,title.html
- >
< title> HTML Demo< / title>
< / head>
< frameset rows =" 100,210,*" ID = QUOT;演示"名称= QUOT;演示">
< frame name =" title" ID = QUOT;标题" SRC =" title.html"滚动= QUOT;否] />
< frameset cols =" *,*">
< frame name =" code1" ID = QUOT; CODE1" SRC ="中将Html.HTML" />
< frame name =" code2" ID = QUOT;码2" SRC =" css.html" />
< / frameset>
< frame name =" output" ID = QUOT;输出" />
< / frameset>
< / html>
这里是title.html的代码
< html>
< head>
<! -
新关于JavaScript的观点
教程6
案例问题3
网页设计演示控制按钮
作者:Greg Funston
日期:2008年11月9日
文件名:title.html
支持文件:title.css
- >
< title>网页设计演示控制按钮< / title>
< link href =" title.css"的rel ="样式表"类型= QUOT;文本/ CSS" />
< script src ="" type =" text / javascript">< / script>
< script type =" text / javascript">
function showPreview(){
parent.document.getElementById(" demo")。rows =" 100,*,1"
}
函数showCode(){
parent.document.getElementById(" demo")。rows =" 100,1,*"
parent.frames.document.getElementById(" code1")。tex tarea.style.height =" 300"
parent.frames.document.getElementById(" code2")。tex tarea.style.height =" 300"
}
function showBoth(){
parent.document.getElementById(" demo" ).rows =" 100,2 10,*
}
< / script>
* /
< / head>
< body>
< form name =" control" ID = QUOT;控制" action ="">
< h2 id =" demotitle">创建网页< / h2>
< p>
< input type =" button" value ="提交代码 onclick =''sendCode()''>
< input type =" button" value ="仅显示代码 onclick =''showCode()''>
< input type =" button" value ="仅显示预览 onclick =''showPreview()''>
< input type =" button" value ="显示代码和预览 onclick =''showBoth()''>
< / p>
< / form>
< / body>
< / html>
[/ HTML]
我很感激帮助找到我的代码问题。
Hello, I am a new programmer and I am working on a school project. I am being instructed to move up then down the dom. My parent is demo.html then a frameset and then another frameset within the frameset. I have figured out how to get up to the parent and then down to the first frameset and change the rows attribute. However I am stuck on getting to the next level, I am required to change the height of the second frameset textarea to 300 pixels.
here is the code for the demo.html
[HTML]<html>
<head>
<!--
New Perspectives on JavaScript
Tutorial 6
Case Problem 3
Web Design Demo
Filename: demo.html
Supporting files: css.html, html.html, title.html
-->
<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>
here is the code for the title.html
<html>
<head>
<!--
New Perspectives on JavaScript
Tutorial 6
Case Problem 3
Web Design Demo Control Buttons
Author: Greg Funston
Date: November 9,2008
Filename: title.html
Supporting files: title.css
-->
<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(){
parent.document.getElementById("demo").rows="100,* ,1"
}
function showCode(){
parent.document.getElementById("demo").rows="100,1 ,*"
parent.frames.document.getElementById("code1").tex tarea.style.height="300"
parent.frames.document.getElementById("code2").tex tarea.style.height="300"
}
function showBoth(){
parent.document.getElementById("demo").rows="100,2 10,*"
}
</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>
[/HTML]
I would appreciate the help to find the problem with my code.
推荐答案
我知道我的问题就在行中
parent.frames.document.getElementById(" code1")。tex tarea。 style.height =" 300"
和它下面的行也是错误的。我的错误是什么?
I know my problem is in the line
parent.frames.document.getElementById("code1").tex tarea.style.height="300"
and the line below it is wrong also. What am I staing incorrectly?
我有一个包含以下代码的父元素:
[HTML]< html>
< head>
< title> HTML Demo< / title>
< / head>
< frameset行= QUOT; 100210,*" ID = QUOT;演示"名称= QUOT;演示">
< frame name =" title" ID = QUOT;标题" SRC =" title.html"滚动= QUOT;否] />
< frameset cols =" *,*">
< frame name =" code1" ID = QUOT; CODE1" SRC ="中将Html.HTML" />
< frame name =" code2" ID = QUOT;码2" SRC =" css.html" />
< / frameset>
< frame name =" output" ID = QUOT;输出" />
< / frameset>
< / html>
[/ HTML]和我需要向下两级,使textarea feilds高度达到300像素。我需要通过一个名为css.html的文件执行此操作。它是上面代码名称中的第二个框架=" code2"
我需要更改此参数框架名称=" title"
到目前为止我的代码是:
[HTML]< html>
< head>
< title>网页设计演示控制按钮< / title>
< link href =" title.css"的rel ="样式表"类型= QUOT;文本/ CSS" />
< script src ="" type =" text / javascript">< / script>
< script type =" text / javascript">
function showPreview (){top.document.getElementById(" demo")。rows =" 100,*,1"
}
函数showCode() {
top.document.getElementById(" demo")。rows =" 100,1,*"
top.frames [1] .frames [0 ] .document.forms [0] .getElementById(" inputcss")。style.height = 300
}
function showBoth(){
top.document.getElementById(" demo")。rows =" 100,210,*"
}
< / script>
* /
< / head>
< body>
< form name =" control" ID = QUOT;控制" action ="">
< h2 id =" demotitle">创建网页< / h2>
< p>
< input type =" button" value ="提交代码 onclick =''sendCode()''>
< input type =" button" value ="仅显示代码 onclick =''showCode()''>
< input type =" button" value ="仅显示预览 onclick =''showPreview()''>
< input type =" button" value ="显示代码和预览 onclick =''showBoth()''>
< / p>
< / form>
< / body>
< / html>
[/ HTML]
有人可以帮我理解我的问题。
I have a parent element with the following code:
[HTML]<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>
[/HTML]and I am required to go two levels down and make the textarea feilds height to 300 pixels. I am required to do this through a file called css.html.It is the second frame in the above code name="code2"
I am required to change this parameter in the frame name="title"
my code so far is:
[HTML]<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[0].document.forms[0].getElementById("inputcss").style.height=300
}
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>
[/HTML]
Can someone please help me understand my problem with this.
您好,我需要帮助才能更改textarea高度。如果我能弄清楚如何正确使用DOM,我知道该怎么做。我有一个名为title.html的页面,它有一个名为demo.html的父级。演示页面有一个框架集,其中嵌套了另一个框架集。
这是css.html页面打开的地方。我需要访问textarea对象的属性并更改它们。我很感激任何人的帮助。我一直在研究这个问题好几个小时。
Hello, I need help to change the textarea height. I know how to do it if I could figure out how to use the DOM properly. I have a page named title.html and it has a parent named demo.html. The demo page has a frameset with another frameset nested within it.
This is where the css.html page opens. I need to access the attributes of the textarea object and change them. I would appreciate some help from anyone please. I have been working on this for many hours.
这篇关于更改嵌套框架中textarea字段的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!