jsp網(wǎng)頁搜索結(jié)果中實現(xiàn)選中一行使其高亮
更新時間:2014年02月17日 10:24:33 作者:
在做搜索結(jié)果時為了好看需要將選中的行變的高亮些,下面有個不錯的示例,需要的朋友可以參考下
我在做搜索結(jié)果時,為了好看需要將選中的行變的高亮些,我使用了一個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)頁中動態(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)頁中動態(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>");
您可能感興趣的文章:
相關(guān)文章
基于OO的動畫附加插件,可以實現(xiàn)彈跳、漸隱等動畫效果 分享
基于OO的動畫附加插件,可以實現(xiàn)彈跳、漸隱等動畫效果 分享,需要的朋友可以參考一下2013-06-06javascript實現(xiàn)頁面刷新時自動清空表單并選中的方法
這篇文章主要介紹了javascript實現(xiàn)頁面刷新時自動清空表單并選中的方法,涉及javascript中reset與focus方法的相關(guān)使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-07-07全面了解構(gòu)造函數(shù)繼承關(guān)鍵apply call
下面小編就為大家?guī)硪黄媪私鈽?gòu)造函數(shù)繼承關(guān)鍵apply call。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-07-07第九篇Bootstrap導(dǎo)航菜單創(chuàng)建步驟詳解
這篇文章主要介紹了Bootstrap導(dǎo)航菜單創(chuàng)建步驟詳解的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-06-06window.location.href和window.open窗口跳轉(zhuǎn)區(qū)別解析
這篇文章主要為大家介紹了window.location.href和window.open 跳轉(zhuǎn)區(qū)別解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-07-07