关于使用include包含js文件的问题 是把grid.js放在include目录里了吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 js文件中不能有<script></script>标签,<script src="include/grid.js"></script>放在head区试试 没有问题的。js文件中的<script></script>肯定去掉了,路径和文件名也没有错。大家可以测试一下。真是不理解 index.asp<HTML> <HEAD><title>WebForm12</title><!--#include file="2.js" --></HEAD> <body MS_POSITIONING="GridLayout"> <table cellspacing="0" rules="all" border="1" id="DataGrid1" style="border-collapse:collapse;Z-INDEX: 101; LEFT: 113px; POSITION: absolute; TOP: 95px"> <tr> <td>Title</td><td>CreateDate</td><td>pid</td><td>HitCount</td><td>Test</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-1 0:00:00</td><td>10</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-2 0:00:00</td><td>11</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-3 0:00:00</td><td>12</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-4 0:00:00</td><td>13</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-5 0:00:00</td><td>14</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-6 0:00:00</td><td>15</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-7 0:00:00</td><td>16</td><td>111</td><td>432</td> </tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)"> <td>aa1</td><td>2003-10-8 0:00:00</td><td>17</td><td>111</td><td>432</td> </tr></table> </form> </body></HTML>2.js<script> var curRowNum = null; //鼠标移到 function MouseOver(curRow) { var e=event.srcElement; if(e.tagName == null) return; if(e.tagName=="TABLE" || e.tagName=="TBODY") return; //得到当前行 var nRow = e.parentElement.rowIndex; if (curRowNum != nRow ) { curRow.style.backgroundColor='#FFE0C0'; } } //鼠标移出 function MouseOut(curRow) { var e=event.srcElement; if(e.tagName == null) return; if(e.tagName=="TABLE" || e.tagName=="TBODY") return; //得到当前行 var nRow = e.parentElement.rowIndex; if (curRowNum != nRow ) { curRow.style.backgroundColor='white'; } } </script> 不知道我这边为什么不可以。使用 nffly(逆风飞扬) 的方法可以。 文件grid.js里面不能有<script></script>标签啊你把标签去掉啊 .js里面不能有<script></script>标签他本身就是脚本内容 用<!--#include file="2.js" -->肯定是错的!如果你要用<!--#include file="2.js" -->那么2.js里面就要有<script></script>直接用<script src="2.js"></script>不是很好吗?如果还是有问题,你把asp用浏览器打开,然后查看源文件,把源文件贴出来看看。 哦,不好意思,没仔细看,你的2.js里有<script>^_^那如果还不能正常运行,你查看源文件的方法把代码贴出来看看。 firefox中的margin-left问题 又有一个问题 为什么我写的HTML里Select无法调用一个函数?----高手帮我修改下 请教,处理未定义对象的办法 请问一下jcplayer播放flv视频,怎么监听播放结束? parseFloat的问题 如何屏蔽掉按住shift键的新打开窗口,马上给分! 简单问题, /[\W]/g 和 /[^\d]/g 怎么解释? js编辑文本 上传为文件 怎么实现? 提交控制的问题,挺急,大家来帮忙 滚动条怪问题! javascript网易免费空间去除广告
<HTML>
<HEAD>
<title>WebForm12</title>
<!--#include file="2.js" -->
</HEAD>
<body MS_POSITIONING="GridLayout">
<table cellspacing="0" rules="all" border="1" id="DataGrid1" style="border-collapse:collapse;Z-INDEX: 101; LEFT: 113px; POSITION: absolute; TOP: 95px">
<tr>
<td>Title</td><td>CreateDate</td><td>pid</td><td>HitCount</td><td>Test</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-1 0:00:00</td><td>10</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-2 0:00:00</td><td>11</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-3 0:00:00</td><td>12</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-4 0:00:00</td><td>13</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-5 0:00:00</td><td>14</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-6 0:00:00</td><td>15</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-7 0:00:00</td><td>16</td><td>111</td><td>432</td>
</tr><tr onclick="RowClick(this)" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
<td>aa1</td><td>2003-10-8 0:00:00</td><td>17</td><td>111</td><td>432</td>
</tr>
</table>
</form>
</body>
</HTML>2.js
<script>
var curRowNum = null;
//鼠标移到
function MouseOver(curRow)
{
var e=event.srcElement;
if(e.tagName == null) return;
if(e.tagName=="TABLE" || e.tagName=="TBODY") return;
//得到当前行
var nRow = e.parentElement.rowIndex;
if (curRowNum != nRow )
{
curRow.style.backgroundColor='#FFE0C0';
}
}
//鼠标移出
function MouseOut(curRow)
{
var e=event.srcElement;
if(e.tagName == null) return;
if(e.tagName=="TABLE" || e.tagName=="TBODY") return;
//得到当前行
var nRow = e.parentElement.rowIndex;
if (curRowNum != nRow )
{
curRow.style.backgroundColor='white';
}
}
</script>
你把标签去掉啊
他本身就是脚本内容
如果你要用<!--#include file="2.js" -->那么2.js里面就要有<script></script>直接用<script src="2.js"></script>不是很好吗?如果还是有问题,你把asp用浏览器打开,然后查看源文件,把源文件贴出来看看。
那如果还不能正常运行,你查看源文件的方法把代码贴出来看看。