A:
–Latest–
發覺下面不對啊。無法在grid完全加載之後調用“redIt”代碼。嘗試使用setTimeout(function, 10000),但要間隔10s才能turn to red…
最後發現renderer函數!我是ExtJS菜鳥請見諒。我隻想對第六列使用renderer,有誰可以幫忙解決?
var grid= new Ext.grid.TableGrid("tableId",{//使用Extjs表格顯示數據 remove:false, columns:[ {dataIndex: "tcol-0"}, {dataIndex: "tcol-1"}, {dataIndex: "tcol-2"}, {dataIndex: "tcol-3"}, {dataIndex: "tcol-4"}, {dataIndex: "tcol-5", renderer: function(value, columnIndex){ value = value.replace(/【/g,'<span style="color:red">【');// /【/g RE value = value.replace(/】/g,'】</span>');//高亮“內容”某些字體為紅色 return value; } } ] });
–Previous 30Oct2013–
https://www.w3school.com.cn/tiy/t.asp?f=jquery_selector_class
<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".intro").css("background-color","#B2E0FF"); var t = $(".intro").html();//alert(t); var i = t.indexOf('is');//alert(i); if(i!=0){ t = t.replace('is','<font color="red">is</font>');alert(t); $(".intro").html(t); } }); </script> </head> <body> <html> <body> <h1>Welcome to My Homepage</h1> <p class="intro">My name is Donald</p> <p>I live in Duckburg</p> <p>My best friend is Mickey</p> <p id="choose"> Who is your favourite: <ul> <li>Goofy</li> <li>Mickey</li> <li>Pluto</li> </ul> </p> </body> </html> </body> </html>