jsp網(wǎng)頁(yè)搜索結(jié)果中實(shí)現(xiàn)選中一行使其高亮
更新時(shí)間:2014年02月17日 10:24:33 作者:
在做搜索結(jié)果時(shí)為了好看需要將選中的行變的高亮些,下面有個(gè)不錯(cuò)的示例,需要的朋友可以參考下
我在做搜索結(jié)果時(shí),為了好看需要將選中的行變的高亮些,我使用了一個(gè)onclick 事件:
var assno="";
function check(obj,che,rwid){
if(obj.checked==true){
document.getElementById(rwid).style.background ="blue";
assno=document.getElementById(che).value;
alert(assno);
}
}
這是網(wǎng)頁(yè)中動(dòng)態(tài)生成的html代碼:
out.println("<tr id="+idrow+"><td align=/"center/"><input type=/"checkbox/" onclick=/"check(this,'"+par+"','"+idrow+"');/"/></td>");
out.println("<td id=/""+par+"/"align=/"center/" value=/""+Info.getAssetsNo()+"/">"+Info.getAssetsNo()+"</td>");
out.println("<td align=/"center/">"+Info.getSerialNo()+"</td>");
out.println("<td align=/"center/">"+Info.getAssetsName()+"</td>");
out.println("<td align=/"center/">"+Info.getAssetsClass()+"</td>");
out.println("<td align=/"center/">"+Info.getCgTime()+"</td>");
out.println("<td align=/"center/">"+Info.getGbTime()+"</td>");
out.println("<td align=/"center/">"+Info.getConfigInfo()+"</td>");
復(fù)制代碼 代碼如下:
var assno="";
function check(obj,che,rwid){
if(obj.checked==true){
document.getElementById(rwid).style.background ="blue";
assno=document.getElementById(che).value;
alert(assno);
}
}
這是網(wǎng)頁(yè)中動(dòng)態(tài)生成的html代碼:
復(fù)制代碼 代碼如下:
out.println("<tr id="+idrow+"><td align=/"center/"><input type=/"checkbox/" onclick=/"check(this,'"+par+"','"+idrow+"');/"/></td>");
out.println("<td id=/""+par+"/"align=/"center/" value=/""+Info.getAssetsNo()+"/">"+Info.getAssetsNo()+"</td>");
out.println("<td align=/"center/">"+Info.getSerialNo()+"</td>");
out.println("<td align=/"center/">"+Info.getAssetsName()+"</td>");
out.println("<td align=/"center/">"+Info.getAssetsClass()+"</td>");
out.println("<td align=/"center/">"+Info.getCgTime()+"</td>");
out.println("<td align=/"center/">"+Info.getGbTime()+"</td>");
out.println("<td align=/"center/">"+Info.getConfigInfo()+"</td>");
您可能感興趣的文章:
- angularjs實(shí)現(xiàn)搜索的關(guān)鍵字在正文中高亮出來(lái)
- Angularjs實(shí)現(xiàn)搜索關(guān)鍵字高亮顯示效果
- 用JS將搜索的關(guān)鍵字高亮顯示實(shí)現(xiàn)代碼
- 用js查找法實(shí)現(xiàn)當(dāng)前欄目的高亮顯示的代碼
- 兩種簡(jiǎn)單實(shí)現(xiàn)菜單高亮顯示的JS類代碼
- Javascript實(shí)現(xiàn)的CSS代碼高亮顯示
- javascript 關(guān)鍵字高亮顯示實(shí)現(xiàn)代碼
- javascript高亮效果的二種實(shí)現(xiàn)方法
- js 玩轉(zhuǎn)正則表達(dá)式之語(yǔ)法高亮
- JavaScript實(shí)現(xiàn)的搜索及高亮顯示功能示例
相關(guān)文章
javascript用戶注冊(cè)提示效果的簡(jiǎn)單實(shí)例
這個(gè)可以增加用戶驗(yàn)證,不用js alert來(lái)作提示,而是在右邊提示,現(xiàn)在很多網(wǎng)站都這樣做,有需要的朋友可以參考一下2013-08-08基于OO的動(dòng)畫附加插件,可以實(shí)現(xiàn)彈跳、漸隱等動(dòng)畫效果 分享
基于OO的動(dòng)畫附加插件,可以實(shí)現(xiàn)彈跳、漸隱等動(dòng)畫效果 分享,需要的朋友可以參考一下2013-06-06javascript實(shí)現(xiàn)頁(yè)面刷新時(shí)自動(dòng)清空表單并選中的方法
這篇文章主要介紹了javascript實(shí)現(xiàn)頁(yè)面刷新時(shí)自動(dòng)清空表單并選中的方法,涉及javascript中reset與focus方法的相關(guān)使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07全面了解構(gòu)造函數(shù)繼承關(guān)鍵apply call
下面小編就為大家?guī)?lái)一篇全面了解構(gòu)造函數(shù)繼承關(guān)鍵apply call。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-07-07第九篇Bootstrap導(dǎo)航菜單創(chuàng)建步驟詳解
這篇文章主要介紹了Bootstrap導(dǎo)航菜單創(chuàng)建步驟詳解的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06window.location.href和window.open窗口跳轉(zhuǎn)區(qū)別解析
這篇文章主要為大家介紹了window.location.href和window.open 跳轉(zhuǎn)區(qū)別解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07uniapp實(shí)現(xiàn)日期時(shí)間選擇器
這篇文章主要為大家詳細(xì)介紹了uniapp實(shí)現(xiàn)日期時(shí)間選擇器,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-10-10