日期:2014-05-18 浏览次数:20511 次
<script language="JavaScript" type="text/javascript"> [color=#FF0000]var objDrp=document.getElementById("DropDownList1"); var arr_result = new Array(); for(i=0;i<objDrp.options.length;i++) { arr_result[i] = objDrp.options[i].value; }[/color] if(document.createRange){ var range = document.createRange(); }else var range = document.body.createTextRange(); if(range.findText){ while(range.findText("和尚")){ range.pasteHTML(range.text.fontcolor("#ff0000")); range.collapse(true); } }else{ var s,n; s = window.getSelection(); while(window.find("和尚")){ var n = document.createElement("SPAN"); n.style.color="#ff0000" s.getRangeAt(0).surroundContents(n); } } </script>
range.findText(objDrp.innerHTML) //OR range.findText(objDrp.innerText) //OR range.findText(objDrp.value)
------解决方案--------------------
我怎么没看到红色的,FF 3.0