怎样利用函数来改变表单中的样式?

来源:百度知道 编辑:UC知道 时间:2024/06/03 10:42:40
下面的方法没有成功.不知为什么?

<input name="an" type="button" id="an" value="下标" onclick="show()" />

<form id="form1" name="form1" method="post" action="">

<p>
<input type="text" style="font-family:方正舒体" value="eee\<br>eeeeee" name="textfield" />
</p>
</form>
<Script>
function show()
{
var str=document.form1.textfield.value
document.form1.textfield.style="font-family:宋体"}
</Script>

你没有选择成员

<input name="an" type="button" id="an" value="下标" onclick="show()" />

<form id="form1" name="form1" method="post" action="">

<p>
<input type="text" style="font-family:方正舒体" value="eee\<br>eeeeee" name="textfield" />
</p>
</form>
<Script>
function show()
{
var str=document.form1.textfield.value
document.form1.textfield.style.fontFamily="宋体"}
</Script>