使用javascript 查询特定的table中的内容
页面中有一个table包含两列,数据由后台生成,行数不定:(如图)
原始数据:
现在通过javascript进行查询,效果如下三图:
开始查询
查询中......
查询得到的自后结果
JAVASCRIPT代码:
JS代码
<script language="javascript" tpe="text/javascript">
function searchMaterial()
{
var strcellCode;
var strcellName;
var strtextCode=document.all.txtCode.value;
strtextCode=strtextCode.toLowerCase();
var strtextName=document.all.txtName.value;
strtextName=strtextName.toLowerCase();
for (i=1; i < document.all.oTable.rows.length; i++)
{
strcellCode=document.all.oTable.rows(i).cells(0).innerText ;
strcellName=document.all.oTable.rows(i).cells(1).innerText ;
strcellCode=strcellCode.toLowerCase();
strcellName=strcellName.toLowerCase();
if( (strtextCode=="" || strcellCode.indexOf(strtextCode)>0)
&&(strtextName=="" || strcellName.indexOf(strtextName)>0))
{document.all.oTable.rows(i).style.display="";}
else
&
相关文档:
1.document.formName.item("itemName") 问题
说明:IE下,可以使用document.formName.item("itemName")或 document.formName.elements["elementName"];Firefox下,只能使用 document.formName.elements["elementName"].
解决方法:统一使用document.formName.elements["elementName"].
2.集合类对象问题
说明:IE下,可 ......
JavaScript语法集锦是对javascript常用函数的一些小结,比较实用,建议收藏,方便查找需要的资料。
click() 对象.click() 使对象被点击。
closed 对象.closed 对象窗口是否已关闭true/false
clearTimeout(对象) 清除已设置的setTimeout对象
clearInterval(对象) 清除已设置的setInterval对象&n ......
JavaScript 是 Web 开发与设计中不可或缺的东西,不管是一个简单的网页还是一个专业的站点,也不管你是高手还是菜鸟,如今 JavaScript
库越来越强大,可以胜任许多复杂的工作,然而同时,人们在众多 JavaScript 库面前又觉得无所适从,本文,我们将使用 Google 搜索出排名前 10 位的
JavaScript 库,并对它们逐一 ......
var OnPasteCheckIntNum = function()
{
if(window.clipboardData)
{
if(isNaN(window.clipboardData.getData('text')))
{
......
JavaScript提供了一个RegExp对象来完成有关正则表达式的操作和功能,每一条正则表达式模式对应一个RegExp实例。有两种方式可以创建RegExp对象的实例。
使用RegExp的显式构造函数,语法为:new RegExp("pattern"[,"flags"])。
使用RegExp的隐式构造函数,采用纯文本格式:/pattern/[flags]。
pattern部分为要使用的正则 ......