如何将此文本框中文字属性在另一文本框中显示?

来源:百度知道 编辑:UC知道 时间:2024/09/28 12:50:57
<SCRIPT LANGUAGE="JavaScript">
function changeSize(obj){
document.all.modes.style.fontSize = obj.value;
}
function changeFont(obj){
document.all.modes.style.fontFamily = obj.value;
}
</SCRIPT>
<select name="select" onChange="changeFont(this)">
<option value="黑体">黑体</option>
<option value="宋体" selected>宋体</option>
</select>
<select name="select2" onChange="changeSize(this)">
<option value="9">五号</option>
<option value="12" selected>四号</option>
</select>
<textarea name="modes" cols="52" rows="6" style="width: 500px;height: 300px"></textarea>
<input name="mode" type="hidden" id="vvv">

上面程序改变文本后如何通过赋值给隐藏input,然后实现在下面DIV中显

包括字体和大小的程序:

<SCRIPT LANGUAGE="JavaScript">
var fs, ff;
fs = "12";
ff = "宋体";
function changeSize(obj){
document.all.modes.style.fontSize = obj.value;
fs = obj.value;
}
function changeFont(obj){
document.all.modes.style.fontFamily = obj.value;
ff = obj.value;
}

function toDIV() {
var oHid = document.getElementById("vvv");
var oDIV = document.getElementById("yhu");
var oTxt = document.getElementById("modes");
var fstr = "<span style='font-size:" + fs + "px; font-family:" + ff + "'>";
oHid.value = fstr + oTxt.value + "</span>";
oDIV.innerHTML = oHid.value;
}
</SCRIPT>
<select name="select" onChange="changeFont(this)" ID="Select1&q