在DIV中动态更改HTML? [英] Dynamically changing HTML within a DIV?
问题描述
我很想找到一本描述如何在BIV中更改文本内容(HTML)的书中的段落。
实际上我有一系列HTML字符串,我想放入DIV,
取决于按钮点击等。
把这些东西放到TEXTAREA中TEXT很简单,但我希望能够将b $ b混合到字体系列,重量,尺寸等等。
感谢您的帮助。
DaveH
I am going nuts trying to find a paragraph in a book that described how to
change the text content (HTML) in a DIV.
Actually I have an array of HTML strings that I want to drop into the DIV,
depending on button clicks, etc.
Putting this stuff into TEXTAREA and TEXT is simple, but I want to be able
to mix font families, weights, sizes, and stuff like that.
Thanks for your help.
DaveH
推荐答案
Free-Ed,Ltd。于2003年8月28日在comp.lang.javascript上写道 :
Free-Ed, Ltd. wrote on 28 aug 2003 in comp.lang.javascript:
我很想找到一本描述如何更改DIV中文本内容(HTML)的书中的段落。
实际上我有一系列HTML字符串,我想放入
DIV,具体取决于按钮点击等。
将这些东西放入TEXTAREA和TEXT很简单,但我希望能够混合字体系列,重量,大小和类似的东西。
I am going nuts trying to find a paragraph in a book that described
how to change the text content (HTML) in a DIV.
Actually I have an array of HTML strings that I want to drop into the
DIV, depending on button clicks, etc.
Putting this stuff into TEXTAREA and TEXT is simple, but I want to be
able to mix font families, weights, sizes, and stuff like that.
< script type =" text / javascript">
t1 ="< p style =''color:red;''> hi< \ / p>"
t2 ="< p style =''颜色:绿色;''>那里< \ / p>"
< / script>
< button onclick = div1.innerHTML = t2> t2< / button>
< div id =" div1" >< / div>
IE6测试
-
Evertjan。
荷兰。
(请将x''es更改为我的电子邮件地址中的点数)
<script type="text/javascript">
t1="<p style=''color:red;''>hi<\/p>"
t2="<p style=''color:green;''>there<\/p>"
</script>
<button onclick=div1.innerHTML=t1>t1</button>
<button onclick=div1.innerHTML=t2>t2</button>
<div id="div1"></div>
IE6 tested
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
Free-Ed,Ltd。写道:
Free-Ed, Ltd. wrote:
我很想找到一本描述如何在DIV中更改文本内容(HTML)的书中的段落。
I am going nuts trying to find a paragraph in a book that described how to
change the text content (HTML) in a DIV.
http://www.oreillynet.com/pub/a/java.../17/DOM- 2.html
http://www.oreillynet.com/pub/a/java.../07/DOM-2.html
- -
David Dorward http://dorward.me.uk/
http://www.oreillynet.com/pub/a/java.../17/DOM-2.html
http://www.oreillynet.com/pub/a/java.../07/DOM-2.html
--
David Dorward http://dorward.me.uk/
Evertjan。写道:
Evertjan. wrote:
< button onclick = div1.innerHTML = t1> t1< / button>
< button onclick = div1.innerHTML = t2> t2< / button>
< div id =" div1">< / div>
IE6经过测试
<button onclick=div1.innerHTML=t1>t1</button>
<button onclick=div1.innerHTML=t2>t2</button>
<div id="div1"></div>
IE6 tested
Mozilla 1.4(即Netscape 7.1) - 失败
Opera 7.11 - 失败
-
David Dorward http://dorward.me.uk/
这篇关于在DIV中动态更改HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!