<a href='javascript:add()'>add</a>
<a href='javascript:del()'>del</a>
<script type="text/javascript">
var char = ""
var d = document.getElementById("ipt")
function add()
{
var v = d.value
if(v.substring(v.length - char.length) != char){
d.value = v + char
}
}
function del()
{
var v = d.value
if(v.substring(v.length - char.length) == char){
d.value = v.substring(0, v.length - char.length)
}
}
</script>
用js控制文本域的样式,比如点击加粗的事件中可以这样写function B()
{
var b=document.getElementById("b").style=" font-weight: bold"
}
b是文本域的id