改变文本域的字体属性 建立两个下拉列表,分别表示字体类型和大小,实现在文本域中输入文字是可以点击下拉菜单选择字体大小类型并提交的功能。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style>*{margin:0; padding:0;}</style></head><body> <form id="form"> <textarea id="t" style="width:200px; height:100px"></textarea> <select id="zh"> <option>--请选择字号--</option> <option value="12px">12px</option> <option value="14px">14px</option> <option value="16px">16px</option> <option value="18px">18px</option> </select> <select id="zt"> <option>--请选择字体--</option> <option value="Verdana">Verdana</option> <option value="Geneva">Geneva</option> <option value="sans-serif">sans-serif</option> <option value="宋体">宋体</option> </select> <input id="btn" type="button" value="submit" /> </form> <script> var t = document.getElementById('t'), zh = document.getElementById('zh'), zt = document.getElementById('zt'); zh.onchange = function(){ var value = this[this.selectedIndex].value; t.style.fontSize = value; }; zt.onchange = function(){ var value = this[this.selectedIndex].value; t.style.fontFamily = value; }; document.getElementById('btn').onclick = function(){ document.getElementById('form').submit(); }; </script></body></html>是这意思吗? JS幻灯片功能出现的问题。。。。 通过JS设置对象背景色 怎样做flash视频聊天?(web) 高分求意见! 如何让子窗口永远停在父窗口上面? 高手请进,解决后马上接贴 这个地方怎么实现的? 如何得到某区域中的某ID的对象 回退的处理,急啊!!!1 如何判断<td>内是否 easyui tabs hideheader 用法 如何用javascript控制点击超链接 求正則,驗證 文本中只能以逗號隔開。請看->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
*{margin:0; padding:0;}
</style>
</head><body>
<form id="form">
<textarea id="t" style="width:200px; height:100px"></textarea>
<select id="zh">
<option>--请选择字号--</option>
<option value="12px">12px</option>
<option value="14px">14px</option>
<option value="16px">16px</option>
<option value="18px">18px</option>
</select>
<select id="zt">
<option>--请选择字体--</option>
<option value="Verdana">Verdana</option>
<option value="Geneva">Geneva</option>
<option value="sans-serif">sans-serif</option>
<option value="宋体">宋体</option>
</select>
<input id="btn" type="button" value="submit" />
</form>
<script>
var t = document.getElementById('t'),
zh = document.getElementById('zh'),
zt = document.getElementById('zt');
zh.onchange = function(){
var value = this[this.selectedIndex].value;
t.style.fontSize = value;
};
zt.onchange = function(){
var value = this[this.selectedIndex].value;
t.style.fontFamily = value;
};
document.getElementById('btn').onclick = function(){
document.getElementById('form').submit();
};
</script>
</body>
</html>是这意思吗?