- JScript code
<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>
上面红的部分为读DropDownList!
我想把“和尚”换成读出的DropDownList的值怎么改谢谢!
------解决方案--------------------------------------------------------
把“和尚”换成读出的DropDownList的值
//"和尚"改成document.getElementById("DropDownList1").value
------解决方案--------------------------------------------------------
- JScript code
range.findText(objDrp.innerHTML)//ORrange.findText(objDrp.innerText)//ORrange.findText(objDrp.value)
------解决方案--------------------------------------------------------
我怎么没看到红色的,FF 3.0