[code] ?<head> ?</head> ? ?<body> ?&l […]
wenzi
[code] <style> #g_div{text-align:right;overflow:h […]
定时大屏幕显示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
<!--XAD_STARTX--> <table width='760' border='0' cellspacing='0' cellpadding='0'> <tr> <td align='center'> <!--全屏开始--> <!--interstitial begin--> <script language="JavaScript"> <!-- //时间计算 var SYfullscreen = false; today = new Date(); function testdate() { if (today.getMonth() == '5') //是否为6月 { if (today.getDate() == '17') //是否为17日 { <!--28B75C5182CC --> //全屏开始 if (today.getHours() >= '14' && today.getHours() < '15') { adInterPath = 'http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?http://sina.allyes.com/main/adfclick?db=sina&bid=43927,70126,70175&cid=0,0,0&sid=66655&advid=1917&camid=10329&show=ignore&url=http://www.adtools.cn/click.csp?.a3=6582&url=http://www.tongfangpc.com/qjht/0604jycx/index.htm${}http://ad4.sina.com.cn/200605/11/54687_750450.jpg'; SYfullscreen = true } <!--$$ limeng / 2006 - 5 - 17 14: 00: 01~2006 - 5 - 17 14: 59: 59 / B $ --> <!--7C9D3BC7CB30 --> //全屏开始 if (today.getHours() >= '15' && today.getHours() < '16') { adInterPath = 'http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?http://sina.allyes.com/main/adfclick?db=sina&bid=44393,70687,70736&cid=0,0,0&sid=67143&advid=2510&camid=10389&show=ignore&url=http://www.ford.com.cn/cn/showroom/mondeo/index.htm${}http://ad4.sina.com.cn/200605/15/54990_750x450.jpg'; SYfullscreen = true; } <!--$$ limeng / 2006 - 5 - 17 15: 00: 01~2006 - 5 - 17 15: 59: 59 / B $ --> <!--161DBA855406 --> //全屏开始 if (today.getHours() >= '19' && today.getHours() < '20') { adInterPath = 'http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?http://sina.allyes.com/main/adfclick?db=sina&bid=43865,70060,70109&cid=0,0,0&sid=66593&advid=2796&camid=10013&show=ignore&url=http://219.136.241.235/minisite/06teana/index.html${}http://ad4.sina.com.cn/200605/16/55155_full-513.jpg'; SYfullscreen = true; } <!--$$ huiyan / 2006 - 5 - 17 19: 00: 01~2006 - 5 - 17 19: 59: 59 / B $ --> } } } testdate(); var MSIE = navigator.userAgent.indexOf("MSIE"); var OPER = navigator.userAgent.indexOf("Opera"); if (SYfullscreen == true) { if (document.all && MSIE != -1 && OPER == -1) { // this is a 4.x browser, no? document.write('<SCRI' + 'PT LANGUAGE="javascript1.2"'); document.writeln(' SRC="http://ad4.sina.com.cn/ads/control/interstitial.js"></SCR' + 'IPT>'); } } // --> </script> <script language="JavaScript"> <!-- if (SYfullscreen == true) { if (document.all && MSIE != -1 && OPER == -1) { // this is a 4.x browser, no? document.write('<DIV ID="hiddenLayer" style="display: none; height: 450px;">'); if (getsGlu) { expandableIframe = '<IFRAME id="interstitialframe" width=750 HEIGHT=450 NORESIZE SCROLLING=No FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0></IFRAME>'; document.write(expandableIframe); } } document.write('</div>'); } // --> </script> <!--interstitial end--> <!--全屏结束--> </td> </tr> </table> <!--XAD_ENDX--> |
多广告轮显
[code] ?<script> ?var how_many_ads = 8; ?var now […]
透出浏览器的浮动图片代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
<script> var imagepath = "../images/temp_img.gif"; //图片地址 var imagewidth = 163; //这两行写图片的大小 var imageheight = 60; var speed = 3; var imageclick = "/bbs/index.asp"; //这里写点击图片连接到的地址 var hideafter = 0; var isie = 0; if (window.navigator.appName == "Microsoft Internet Explorer" && window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE") + 5, window.navigator.appVersion.indexOf("MSIE") + 8) >= 5.5) { isie = 1; } else { isie = 0; } if (isie) { var preloadit = new Image(); preloadit.src = imagepath; } function pop() { if (isie) { x = x + dx; y = y + dy; oPopup.show(x, y, imagewidth, imageheight); if (x + imagewidth + 5 > screen.width) dx = -dx; if (y + imageheight + 5 > screen.height) dy = -dy; if (x < 0) dx = -dx; if (y < 0) dy = -dy; startani = setTimeout("pop();", 50); } } function dismisspopup() { clearTimeout(startani); oPopup.hide(); } function dowhat() { if (imageclick == "dismiss") dismisspopup() else window.open(imageclick); } if (isie) { var x = 0, y = 0, dx = speed, dy = speed; var oPopup = w; indow.createPopup(); var oPopupBody = oPopup.document.body; oPopupBody.style.cursor = "hand" oPopupBody.innerHTML = '<IMG SRC="' + preloadit.src + '">'; oPopup.document.body.onmouseover = new Function("clearTimeout(startani)"); oPopup.document.body.onmouseout = pop; oPopup.document.body.onclick = dowhat; pop(); if (hideafter > 0) setTimeout("dismisspopup()", hideafter * 1000) } </script> |
jscript错误代码及相应解释大全
JScript 语法错误 JScript 语法错误是指当 JScript 语句违反了 JScript 脚本语言 […]
showModelessDialog方法使用详解
Javascript有许多内建的方法来产生对话框,如:window.alert(), window.confi […]
JAVASCRIPT对象及属性教程
JAVASCRIPT对象及属性教程 [CP设计动力 csplanet@21cn.com ] SCRIPT 标记 […]
Ecode解码器
[code] <html> <head> <meta http-equiv=&# […]
JavaScript操作FLASH
JavaScript 操作FLASH 关键要注意以下几点: <object classid=” […]
JavaScript通用库
[code] ?JavaScript在WEB编程中能起到很大的作用,将一些常用的功能写成JavaScript类 […]
jsTimeTest
[code] <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML […]
JS运行时间测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Javascript performance test</title> <style> body, span{font-family: verdana, sans serif; font-size: 12px;} input{margin-right: 20px;} span{padding-left: 20px;} </style> <script> var start; var end; var forLoopTime = 0; var addTime = 0; var subtractTime = 0; var multiplyTime = 0; var divideTime = 0; var divide2Time = 0; var fromArrayTime = 0; var parseIntTime = 0; var varTime = 0; var sinTime = 0; var floorTime = 0; var ifTime = 0; var readGlobalTime = 0; var concatStringsTime = 0; var sortArrayTime = 0; gValue = 123; var continueAfter = false; function testFor() { start = new Date(); for (var i = 0; i <= 1000000; i++) { void(0); } end = new Date(); forLoopTime = end - start; var textElem = document.createTextNode(forLoopTime + 'ms '); document.getElementById('forResult').appendChild(textElem); completed(); } function testAdd() { var value1 = 123; var value2 = 234; var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = value1 + value2; } end = new Date(); addTime = end - start; var textElem = document.createTextNode(addTime + 'ms '); document.getElementById('addResult').appendChild(textElem); completed(); } function testSubtract() { var value1 = 123; var value2 = 234; var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = value2 - value1 } end = new Date(); subtractTime = end - start; var textElem = document.createTextNode(subtractTime + 'ms '); document.getElementById('subtractResult').appendChild(textElem); completed(); } function testMultiply() { var value1 = 123; var value2 = 234; var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = value2 * value1 } end = new Date(); multiplyTime = end - start; var textElem = document.createTextNode(multiplyTime + 'ms '); document.getElementById('multiplyResult').appendChild(textElem); completed(); } function testDivide() { var value1 = 123; var value2 = 234; var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = value2 / value1 } end = new Date(); divideTime = end - start; var textElem = document.createTextNode(divideTime + 'ms '); document.getElementById('divideResult').appendChild(textElem); completed(); } function testDivide2() { var value1 = 123; var value2 = 234; var value3; start = new Date(); var temp = (1 / value1); for (var i = 0; i <= 1000000; i++) { value3 = value2 * temp } end = new Date(); divide2Time = end - start; var textElem = document.createTextNode(divide2Time + 'ms '); document.getElementById('divide2Result').appendChild(textElem); completed(); } function testFromArray() { var value3; var value4 = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = value4[6] } end = new Date(); fromArrayTime = end - start; var textElem = document.createTextNode(fromArrayTime + 'ms '); document.getElementById('fromArrayResult').appendChild(textElem); completed(); } function testParseInt() { var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = parseInt(123.23) } end = new Date(); parseIntTime = end - start; var textElem = document.createTextNode(parseIntTime + 'ms '); document.getElementById('parseIntResult').appendChild(textElem); completed(); } function testVar() { start = new Date(); for (var i = 0; i <= 1000000; i++) { var a = 1; var b = 2; var c = 3; } end = new Date(); varTime = end - start; var textElem = document.createTextNode(varTime + 'ms '); document.getElementById('varResult').appendChild(textElem); completed(); } function testSin() { var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = Math.sin(.1) } end = new Date(); sinTime = end - start; var textElem = document.createTextNode(sinTime + 'ms '); document.getElementById('sinResult').appendChild(textElem); completed(); } function testFloor() { var value3; start = new Date(); for (var i = 0; i <= 1000000; i++) { value3 = Math.floor(43.341) } end = new Date(); floorTime = end - start; var textElem = document.createTextNode(floorTime + 'ms '); document.getElementById('floorResult').appendChild(textElem); completed(); } function testIf() { var value1 = 123; start = new Date(); for (var i = 0; i <= 1000000; i++) { if (value1 < 12) { void(0); } } end = new Date(); ifTime = end - start; var textElem = document.createTextNode(ifTime + 'ms '); document.getElementById('ifResult').appendChild(textElem); completed(); } function testReadGlobal() { var value,start = new Date(); for (var i = 0; i <= 1000000; i++) { value = gValue; } end = new Date(); readGlobalTime = end - start; var textElem = document.createTextNode(readGlobalTime + 'ms '); document.getElementById('readGlobalResult').appendChild(textElem); completed(); } function testConcatStrings() { var string1 = 'abcdefghijklmnopqrstuvxyz' var string2 = 'abcdefghijklmnopqrstuvxyz' var string3; start = new Date(); for (var i = 0; i <= 1000000; i++) { string3 = string1 + string2; } end = new Date(); concatStringsTime = end - start; var textElem = document.createTextNode(concatStringsTime + 'ms '); document.getElementById('concatStringsResult').appendChild(textElem); completed(); } function testSortArray() { var theArray = new Array; for (i = 0; i <= 10000; i++) theArray[i] = parseInt(Math.random() * 10000); start = new Date(); theArray.sort(); end = new Date(); sortArrayTime = end - start; var textElem = document.createTextNode(sortArrayTime + 'ms '); document.getElementById('sortArrayResult').appendChild(textElem); completed(); } function completed() { if (continueAfter) { if (forLoopTime == 0) setTimeout('testFor()', 10); else if (addTime == 0) setTimeout('testAdd()', 10); else if (subtractTime == 0) setTimeout('testSubtract()', 10); else if (multiplyTime == 0) setTimeout('testMultiply()', 10); else if (divideTime == 0) setTimeout('testDivide()', 10); else if (divide2Time == 0) setTimeout('testDivide2()', 10); else if (fromArrayTime == 0) setTimeout('testFromArray()', 10); else if (parseIntTime == 0) setTimeout('testParseInt()', 10); else if (varTime == 0) setTimeout('testVar()', 10); else if (sinTime == 0) setTimeout('testSin()', 10); else if (floorTime == 0) setTimeout('testFloor()', 10); else if (ifTime == 0) setTimeout('testIf()', 10); else if (readGlobalTime == 0) setTimeout('testReadGlobal()', 10); else if (concatStringsTime == 0) setTimeout('testConcatStrings()', 10); else if (sortArrayTime == 0) setTimeout('testSortArray()', 10); else continueAfter = false; } if (forLoopTime != 0 && addTime != 0 && subtractTime != 0 && multiplyTime != 0 && divideTime != 0 && divide2Time != 0 && fromArrayTime != 0 && parseIntTime != 0 && varTime != 0 && sinTime != 0 && floorTime != 0 && ifTime != 0 && readGlobalTime != 0 && concatStringsTime != 0 && sortArrayTime != 0) { averageTime = (forLoopTime + addTime + subtractTime + multiplyTime + divideTime + divide2Time + fromArrayTime + parseIntTime + varTime + sinTime + floorTime + ifTime + readGlobalTime + concatStringsTime + sortArrayTime) / 15; document.getElementById('averageResult').innerHTML = '<b>' + parseInt(averageTime) + 'ms</b>'; } } </script> </head> <body> <form> <input type="button" value="for-loop" onclick="testFor()">1000000 times:<span id="forResult"></span><br> <input type="button" value="add" onclick="testAdd()">1000000 times: <span id="addResult"></span><br> <input type="button" value="subtract" onclick="testSubtract()">1000000 times:<span id="subtractResult"></span><br> <input type="button" value="multiply" onclick="testMultiply()">1000000 times:<span id="multiplyResult"></span><br> <input type="button" value="divide" onclick="testDivide()">1000000 times:<span id="divideResult"></span><br> <input type="button" value="divide2" onclick="testDivide2()">1000000 times:<span id="divide2Result"></span><br> <input type="button" value="get value from array" onclick="testFromArray()">1000000 times:<span id="fromArrayResult"></span><br> <input type="button" value="parseInt()" onclick="testParseInt()">1000000 times:<span id="parseIntResult"></span><br> <input type="button" value="var" onclick="testVar()">1000000 times:<span id="varResult"></span><br> <input type="button" value="Math.sin()" onclick="testSin()">1000000 times:<span id="sinResult"></span><br> <input type="button" value="Math.floor()" onclick="testFloor()">1000000 times:<span id="floorResult"></span><br> <input type="button" value="if" onclick="testIf()">1000000 times:<span id="ifResult"></span><br> <input type="button" value="read global variable" onclick="testReadGlobal()">1000000 times:<span id="readGlobalResult"></span><br> <input type="button" value="concatenate strings" onclick="testConcatStrings()">1000000 times:<span id="concatStringsResult"></span><br> <input type="button" value="sort Array" onclick="testSortArray()"><span id="sortArrayResult"></span><br> <br> <input type="button" value="Run all tests" onclick="continueAfter=true;completed()">Average time: <span id="averageResult"></span> </form> </body> </html> |
js单元格操作类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
<script language="JavaScript" type="text/JavaScript"> /*--------------------------------------------------------------------------- 表格、单元格操作类 功能: 合并单元格,拆分单元格,向上插入行,向下插入行,向左插入列, 向右插入列,删除行,删除列 设计思路: 将表格按总行与总列数进行网状分割,为每个座标网格找到对应的单元格, 这样,在操作过程中就可以随时找出每个单元格的位置及属性 适用IE5.0以上 -----------------------------------------------------------------------------*/ function LwgTable() { this.tdobj; this.trobj; this.tblobj; this.xy = new Array(); this.x; this.y; } function tmpObj(x, y, obj) { this.x = x; this.y = y; this.obj = obj; } LwgTable.prototype.getObj = function () { var tdobj = document.selection.createRange().parentElement(); if (!tdobj || tdobj.tagName != "TD") return false; var trobj = tdobj.parentElement; if (!trobj || trobj.tagName != "TR") return false; var tblobj = trobj.parentElement.parentElement; if (!tblobj || tblobj.tagName != "TABLE") return false; this.tdobj = tdobj; this.trobj = trobj; this.tblobj = tblobj; return true; } LwgTable.prototype.setxy = function () { for (var i = 0; i < this.tblobj.rows.length; i++) this.xy[i] = new Array(); for (var i = 0; i < this.tblobj.rows.length; i++) { var tmp_row = this.tblobj.rows[i]; var tmp_y = 0; for (var n = 0; n < tmp_row.cells.length; n++) { var tmp_cell = tmp_row.cells[n]; if (this.tdobj == tmp_cell) { this.x = i; tmp_y = this.y = this.findy(i, tmp_y); } for (var c = 0; c < tmp_cell.colSpan; c++) { for (var r = 0; r < tmp_cell.rowSpan; r++) { var tmp_ir = i + r; var tmp_y = this.findy(tmp_ir, tmp_y); if (c == 0 && r == 0) var tmp_obj = new tmpObj(i, tmp_y, tmp_cell); this.xy[tmp_ir][tmp_y] = tmp_obj; } } tmp_y++; } } } LwgTable.prototype.findy = function (x, y) { if (!this.xy[x][y]) return y; else return this.findy(x, y + 1); } LwgTable.prototype.mergeCell = function (what) { switch (what) { case "up": var tmp_obj = this.checkToMerge(-1, 0); if (!tmp_obj) return false; if (this.tdobj.innerHTML != "?") tmp_obj.obj.innerHTML += this.tdobj.innerHTML; tmp_obj.obj.rowSpan += this.dropCell(this.trobj.rowIndex, this.tdobj.cellIndex, 'r'); break; case "down": var tmp_obj = this.checkToMerge(this.tdobj.rowSpan, 0); if (!tmp_obj) return false; if (tmp_obj.obj.innerHTML != "?") this.tdobj.innerHTML += tmp_obj.obj.innerHTML; this.tdobj.rowSpan += this.dropCell(this.trobj.rowIndex + this.tdobj.rowSpan, tmp_obj.obj.cellIndex, 'r'); break; case "left": var tmp_obj = this.checkToMerge(0, -1); if (!tmp_obj) return false; if (this.tdobj.innerHTML != "?") tmp_obj.obj.innerHTML += this.tdobj.innerHTML; tmp_obj.obj.colSpan += this.dropCell(this.trobj.rowIndex, this.tdobj.cellIndex, 'c'); break; case "right": var tmp_obj = this.checkToMerge(0, this.tdobj.colSpan); if (!tmp_obj) return false; if (tmp_obj.obj.innerHTML != "?") this.tdobj.innerHTML += tmp_obj.obj.innerHTML; this.tdobj.colSpan += this.dropCell(this.trobj.rowIndex, this.tdobj.cellIndex + 1, 'c'); break; default: break; } } LwgTable.prototype.checkToMerge = function (x, y) { if (!this.xy[this.x + x]) return false; var tmp_obj = this.xy[this.x + x][this.y + y]; if (!tmp_obj) return false; if (x != 0) { if (tmp_obj.y != this.y || tmp_obj.obj.colSpan != this.tdobj.colSpan) return false; } else if (y != 0) { if (tmp_obj.x != this.x || tmp_obj.obj.rowSpan != this.tdobj.rowSpan) return false; } return tmp_obj; } LwgTable.prototype.dropCell = function (x, y, kind) { var trobj = this.tblobj.rows[x]; if (!trobj) return false; var rowspans = trobj.cells[y].rowSpan; var colspans = trobj.cells[y].colSpan; trobj.deleteCell(y); if (kind == "r") return rowspans; else if (kind == "c") return colspans; } LwgTable.prototype.changeRowspan = function (x, num) { var y = 0; while (y < this.xy[x].length) { var tmp = this.xy[x][y]; if (tmp.obj.rowSpan > 1) { tmp.obj.rowSpan += num; } y += tmp.obj.colSpan; } } LwgTable.prototype.insertRow = function (what, num) { var x = this.x; var x1 = (what == 'up') ? x : (x + 1); if (x1 == this.tblobj.rows.length) { for (var n = 0; n < num; n++) { var newRow = this.tblobj.insertRow(x1); var lastxy = this.xy[this.xy.length - 1]; var i = 0; while (i < lastxy.length) { var newCell = newRow.insertCell(); newCell.innerHTML = "?"; newCell.mergeAttributes(lastxy[i].obj); newCell.rowSpan = 1; i += lastxy[i].obj.colSpan; } } return true; } for (var n = 0; n < num; n++) { var trobj = this.tblobj.rows[x]; var newRow = this.tblobj.insertRow(x1); var delcell = new Array(); for (var i = 0; i < trobj.cells.length; i++) { if (trobj.cells[i].rowSpan == 1) { var newCell = newRow.insertCell(); newCell.innerHTML = "?"; newCell.mergeAttributes(trobj.cells[i]) } else if (what == 'up') { var newCell = newRow.insertCell(); trobj.cells[i].rowSpan += 1; newCell.innerHTML = trobj.cells[i].innerHTML; delcell[i] = 1; newCell.mergeAttributes(trobj.cells[i]) } } var deli = 0; for (i in delcell) { trobj.deleteCell(i - deli); deli++; } } this.changeRowspan(this.x, num); } LwgTable.prototype.deleteRow = function () { if (this.trobj.rowIndex == this.tblobj.rows.length - 1) { this.tblobj.deleteRow(this.trobj.rowIndex); return true; } var y = 0; while (y < this.xy[this.x].length) { var tmp_obj = this.xy[this.x][y].obj; if (tmp_obj.rowSpan > 1) { tmp_obj.rowSpan -= 1; if (tmp_obj.parentElement.rowIndex == this.x) { if (tmp_obj.cellIndex < this.trobj.cells.length - 1) var cellIndex = this.xy[this.x + 1][y + tmp_obj.colSpan].obj.cellIndex; else var cellIndex = this.tblobj.rows[this.x + 1].cells.length; newCell = this.tblobj.rows[this.x + 1].insertCell(cellIndex); newCell.replaceNode(tmp_obj); } } y += tmp_obj.colSpan; } this.tblobj.deleteRow(this.trobj.rowIndex); } LwgTable.prototype.deleteCol = function () { var x = 0; while (x < this.xy.length) { var tmp_obj = this.xy[x][this.y].obj; x += tmp_obj.rowSpan if (tmp_obj.colSpan == 1) { tmp_obj.parentElement.deleteCell(tmp_obj.cellIndex); } else tmp_obj.colSpan -= 1; } } LwgTable.prototype.insertCol = function (what, num) { var x = 0; while (x < this.xy.length) { var tmp_obj = this.xy[x][this.y].obj; x += tmp_obj.rowSpan if (tmp_obj.colSpan == 1) { var cellIndex = (what == "right") ? (tmp_obj.cellIndex + 1) : tmp_obj.cellIndex; for (var n = 0; n < num; n++) { var newCell = tmp_obj.parentElement.insertCell(cellIndex); newCell.innerHTML = "?"; newCell.mergeAttributes(tmp_obj) } } else tmp_obj.colSpan += num; } } LwgTable.prototype.rowSplit = function (num) { if (num < 2) return false; while (num > 1) { var y = 0; var tmp_x = this.x + this.tdobj.rowSpan - 1; var tmp_index = 0; while (y < this.xy[tmp_x].length) { vartmp_obj = this.xy[tmp_x][y] if (this.tdobj.rowSpan > 1) { if (tmp_obj.obj == this.tdobj) { var newCell = this.tblobj.rows[tmp_x].insertCell(tmp_index); newCell.innerHTML = "?"; newCell.mergeAttributes(this.tdobj); newCell.rowSpan = 1 } if (tmp_x == tmp_obj.x) tmp_index++; } else { if (tmp_obj.obj == this.tdobj) { var newRow = this.tblobj.insertRow(this.x + 1); var newCell = newRow.insertCell(0); newCell.innerHTML = "?"; } else tmp_obj.obj.rowSpan += 1; } y += tmp_obj.obj.colSpan; } if (this.tdobj.rowSpan > 1) this.tdobj.rowSpan -= 1; num -= 1; } } LwgTable.prototype.colSplit = function (num) { var x = 0; while (x < this.xy.length) { var tmp_obj = this.xy[x][this.y].obj; x += tmp_obj.rowSpan if (tmp_obj == this.tdobj) { for (var n = 0; n < num; n++) { var newCell = tmp_obj.parentElement.insertCell(this.tdobj.cellIndex); newCell.innerHTML = "?"; newCell.mergeAttributes(tmp_obj) } } else tmp_obj.colSpan += num; } } function table_change() { var t = new LwgTable(); if (!t.getObj()) return false; t.setxy(); var args = table_change.arguments; switch (args[0]) { case "insertrow_up": t.insertRow('up', args[1]); break; case "insertrow_down": t.insertRow('down', args[1]); break; case "deleterow": t.deleteRow(); break; case "deletecol": t.deleteCol(); break; case "insertcol_left": t.insertCol('left', args[1]); break; case "insertcol_right": t.insertCol('right', args[1]); break; case "rowsplit": t.rowSplit(args[1]); break; case "colsplit": t.colSplit(args[1]); break; case "merge": t.mergeCell(args[1]); break default: break; } } </script> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <table border="0" cellpadding="5" cellspacing="1" bgcolor="#999999"> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 合并单元格 </td> <td> <input type="button" name="Submit2" value="向上" onclick="table_change('merge','up')"><input type="button" name="Submit22" value="向下" onclick="table_change('merge','down')"><input type="button" name="Submit23" value="向左" onclick="table_change('merge','left')"><input type="button" name="Submit24" value="向右" onclick="table_change('merge','right')"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 拆分单元格 </td> <td> <input type="button" name="Submit2424" value="拆成3行" onclick="table_change('rowsplit',3)"><input type="button" name="Submit24242" value="拆成2列" onclick="table_change('colsplit',2)"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 插入行 </td> <td> <input type="button" name="Submit242" value="向上插入3行" onclick="table_change('insertrow_up',3)"><input type="button" name="Submit2422" value="向下插入2行" onclick="table_change('insertrow_down',2)"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 插入列 </td> <td> <input type="button" name="Submit2423" value="向左插入3列" onclick="table_change('insertcol_left',3)"><input type="button" name="Submit24223" value="向右插入2列" onclick="table_change('insertcol_right',2)"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 删除行 </td> <td> <input type="button" name="Submit24222" value="删除行" onclick="table_change('deleterow')"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="right" bgcolor="#efefef"> 删除列 </td> <td> <input type="button" name="Submit242222" value="删除列" onclick="table_change('deletecol')"> </td> </tr> </table> 使用方式:先在单元格中建立一个选区,再点击上面按钮<br> <table width="100%" border="1"> <tr> <td colspan="2"> 1 </td> <td> 2 </td> <td> 3 </td> </tr> <tr> <td bgcolor="#CCCCCC"> ? </td> <td rowspan="2"> 47 </td> <td> 5 </td> <td> 6 </td> </tr> <tr> <td rowspan="3"> 45 </td> <td> 8 </td> <td bgcolor="#CCCCCC"> 9 </td> </tr> <tr> <td rowspan="3"> 10 </td> <td bgcolor="#FFFFCC"> 11 </td> <td rowspan="2"> 1214 </td> </tr> <tr> <td bgcolor="#CCCCCC"> 13 </td> </tr> <tr> <td> 123 </td> <td bgcolor="#CCCCCC"> ? </td> <td> 6 </td> </tr> </table> |
带Checkbox的列表框
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
<html> <head> <title>带Checkbox的列表框 - 51windows.Net</title> <meta http-equiv='Content-Type' content="text/html; charset=gb2312"> <style> body,td{font-size:12px;color:#000000;} .checkbox{width:15px;height:15px;} .cked{ margin:1px;padding:2px;width:100%;display:block;background-color:highlight;color:highlighttext; } .nock{ margin:1px;padding:2px;width:100%;display:block; } </style> <meta content="MSHTML 6.00.2900.2912" name='GENERATOR'> </head> <body> <script language='JavaScript'> function HtmlEncode(text){ return text.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>'); } function _checkbox(name,str,defv){ //haiwa@2005-8-17 var arr = str.split("^"); var ck = "",bc = ""; for (var i = 0; i < arr.length; i++) { var thisarr = arr[i].split("@="); if (thisarr[0].length > 0) { var t = (thisarr.length == 2) ? thisarr[0] : arr[i]; var v = (thisarr.length == 2) ? thisarr[1] : arr[i]; if (("," + HtmlEncode(defv).toLowerCase() + ",").replace(/,/g, ',').indexOf("," + v + ",") != -1) { ck = " checked"; cls = "cked"; } else { ck = ""; cls = "nock"; } var thisstr = "<label class=\""+cls+" \" for=\"i_ "+name+"_ "+i+" \" id=\"l_ "+name+"_ "+i+" \">"; thisstr += "<input class=\"checkbox \" onpropertychange=\"document.getElementById('l_"+name+"_"+i+"').className = (document.getElementById('i_"+name+"_"+i+"').checked) ? 'cked' : 'nock';\" onclick=\"document.getElementById('l_" + name + "_" + i + "').className=(document.getElementById('i_" + name + "_" + i + "').checked)?'cked':'nock';\"type = \"checkbox\"" + ck + " name=\""+name+" \" id=\"i_ "+name+"_ "+i+" \" value=\""+HtmlEncode(v)+" \" //> "; thisstr += HtmlEncode(t) + "</label>"; document.write(thisstr); } } } function _getv(o) { var allvalue = ""; if (typeof (o) == "undefined") { return ""; } if (typeof (o.length) == "undefined") { if (o.checked) { return o.value + ","; } else { return ""; } } for (var i = 0; i < o.length; i++) { if (o[i].checked) { allvalue += o[i].value + ","; } } return allvalue; } function _setv(o, defv) { var allvalue = ("," + HtmlEncode(defv).toLowerCase() + ",").replace(/ ,/g, ','); for (var i = 0; i < o.length; i++) { var v = o[i].value; o[i].checked = (allvalue.indexOf("," + v + ",") != -1) } return allvalue; } function _sl(o, b) { for (var i = 0; i < o.length; i++) { o[i].checked = b //if(o[i].checked!=b){o[i].click();} } } //--> </script> <form name='myform' action='?' method='post'> <table width='200' border='0'> <tbody> <tr> <td> <div style="BORDER-RIGHT: #ffffff 2px inset; BORDER-TOP: #ffffff 2px inset; OVERFLOW: auto; BORDER-LEFT: #ffffff 2px inset; WIDTH: 180px; BORDER-BOTTOM: #ffffff 2px inset; HEIGHT: 150px"> <script language='JavaScript'> <!-- _checkbox("city","北京^山东^安徽^重庆^福建^甘肃^广东^广西^贵州^海南^河北^黑龙江^河南^湖北^湖南^内蒙古^江苏^江西^吉林^辽宁^宁夏^青海^山西^陕西^上海^四川^天津^西藏^新疆^云南^浙江^香港^澳门^台湾","北京,山东") //--> </script> </div> </td> </tr> <tr> <td> <button onclick='_sl(document.myform.city,true);'>全选</button><button onclick='_sl(document.myform.city,false);'>全不选</button><button onclick='_setv(document.myform.city,"甘肃,广东");'>set值</button><button onclick='alert(_getv(document.myform.city));'>get值</button> </td> </tr> <tr> <td> <div style="BORDER-RIGHT: #ffffff 2px inset; BORDER-TOP: #ffffff 2px inset; OVERFLOW: auto; BORDER-LEFT: #ffffff 2px inset; WIDTH: 180px; BORDER-BOTTOM: #ffffff 2px inset; HEIGHT: 120px"> <script language='JavaScript'> <!-- _checkbox("WebSite","Google.com@=http://www.google.com^Blueidea.com@=http://www.blueidea.com^51windows.Net@=http://www.51windows.net","http://www.51windows.net") //--> </script> </div> </td> </tr> <tr> <td> <button onclick='_sl(document.myform.WebSite,true);'>全选</button><button onclick='_sl(document.myform.WebSite,false);'>全不选</button><button onclick='_setv(document.myform.WebSite,"http://www.google.com");'>set值</button><button onclick='alert(_getv(document.myform.WebSite));'>get值</button> </td> </tr> <tr> <td align='middle'> <button onclick='document.myform.reset();'>重置表单</button> </td> </tr> </tbody> </table> </form> </body> </html> |
数据显示图
[code] <html><head><title>数据显示图</t […]
嵌入word
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
<script language="javascript"> function insertDoc(filename) { var tmpfile = "c://temp.html"; // check template file if exsited checkFile(tmpfile); var word = new ActiveXObject("Word.Application"); word.visible = false; var doc = word.documents.open(filename, false); if (doc != null) { doc.saveAs(tmpfile, 10); // convert doc to html,请注意如果是Word2000请将参数改为8,word2003为10 doc.close(); } word.quit(); //get images'path from word,then put them into inputbox putImages(tmpfile); } function checkFile(filename) { var fso = new ActiveXObject("Scripting.FileSystemObject"); if (fso.FileExists(filename)) { fso.DeleteFile(filename, true); } } function putImages(filename) { // get data from template file var tmpstr = ""; var fso1 = new ActiveXObject("Scripting.FileSystemObject"); if (fso1.FileExists(filename)) { var txtstrm = fso1.OpenTextFile(filename, 1); tmpstr = txtstrm.readAll(); txtstrm.close(); } // 下面一大段注释掉的代码是为了下次提取word文档中图片的路径用的,现在还用不到。 /** var tmp = ""; var ie = new ActiveXObject("InternetExplorer.Application"); ie.Navigate(filename); while (ie.ReadyState != 4) {} var objs = ie.Document.all; var l = objs.length; var tmptag = ""; var tmpsrc = ""; var body_top = "", body_buttom = "", body_mid = ""; document.writeln("选择文件上传"); body_top = "<table border=1><form name='upladofiles' method='post' action='uploadfiles.jsp'><tr><td>"; document.writeln(body_top); for (i = 0; i < l; i++) { var obj = objs[i]; try { tmptag = obj.tagName.toLowerCase(); if (tmptag == "img") { tmpsrc = obj.src; tmpsrc = tmpsrc.substring(8, tmpsrc.length); body_mid = "<tr><td><input type='file' name='f' id='>" + i + "'></td>"; body_mid = body_mid + "<td>" + tmpsrc + "</td></tr>"; //document.writeln(body_mid); continue; } } catch (e) {} } var tmpcontents = "<tr><td><textarea name='txtDoc' width=150>" + tmpstr + "</textarea></td></tr>"; document.writeln(tmpcontents); document.writeln("<tr><td><input type='submit' name='confirm' value='确定'></td></tr></td></tr></form></table>"); document.writeln("<table><tr><td><iframe name='fr_editor' id='fr_editor' width='717' height='501'></iframe></td></tr></table>"); alert(tmpstr); */ ScriptDiv.focus(); var sel = ScriptDiv.document.selection.createRange(); sel.pasteHTML(tmpstr); fso1.DeleteFile(filename, true); //ie.Quit(); } </script> 好了具体的代码写完了,要测试就要写一个网页 <INPUT type=file name=file1> <INPUT type=button value=ok name=ok LANGUAGE=javascript onclick="return ok_onclick()"> </p><p> <iframe name="ScriptDiv" id="ScriptDiv" width="633" height="1968" ></iframe> </p> |
网页代码常用加解密
code/JS encode.htm
锁定表格栏位范例网页
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
<html> <head> <title>锁定表格栏位范例网页</title> <meta http-equiv='Content-Type' content="text/html; charset=gb2312"> <style type='text/css'> BODY { FONT: 12px 细明体; CURSOR: default } TD { FONT: 12px 细明体; CURSOR: default } .title { BORDER-RIGHT: #555 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 4px; BACKGROUND: #ccc; PADDING-BOTTOM: 4px; OVERFLOW: hidden; BORDER-LEFT: #fff 1px solid; CURSOR: hand; PADDING-TOP: 4px; BORDER-BOTTOM: #555 1px solid; WHITE-SPACE: nowrap } .cdata { BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 3px; BACKGROUND: #fff; PADDING-BOTTOM: 3px; OVERFLOW: hidden; BORDER-LEFT: #fff 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: #ddd 1px solid; WHITE-SPACE: nowrap } </style> <script language='JavaScript'> // 栏位标题 ( 栏位名称 # 栏位宽度 # 资料对齐 ) var DataTitles = new Array("歌手 / 团体#90 #left", "专辑名称 #130#left", "发行公司 #110#left", "本周排名 #58 #center", "排名状况 #58 #center", "上周排名 #58 #center", "上榜周数 #58 #center", "最高名次 #58 #center", "销售百分比 #70 #center") // 栏位资料 ( 二维阵列 ) var DataFields = new Array(); DataFields[0] = new Array("萧亚轩", "爱的主打歌-吻", "维京 Virgin", "1", "持平", "1", "2", "1", "2.9 %"); DataFields[1] = new Array("张惠妹", "发烧", "华纳 Warner", "2", "持平", "2", "2", "2", "2.1 %"); DataFields[2] = new Array("陶吉吉", "黑色柳丁", "全员集合 Shock", "3", "持平", "3", "5", "1", "1.8 %"); DataFields[3] = new Array("S.H.E", "美丽新世界", "华研 HIM", "4", "持平", "4", "6", "1", "1.2 %"); DataFields[4] = new Array("艾薇儿", "展翅高飞", "博德曼 BMG", "5", "新进榜", "-", "1", "5", "1.1 %"); DataFields[5] = new Array("任贤齐", "一个任贤齐", "滚石 Rock", "6", "新进榜", "-", "1", "6", "1.0 %"); DataFields[6] = new Array("范逸臣", "范逸臣第一张专辑", "丰华 Forward", "7", "持平", "7", "2", "7", "0.9 %"); DataFields[7] = new Array("谢霆锋", "无形的他全精选", "新力 Sony", "8", "下跌", "6", "4", "4", "0.9 %"); DataFields[8] = new Array("周蕙", "寂寞城市", "福茂 Decca", "9", "下跌", "5", "3", "5", "0.8 %"); DataFields[9] = new Array("周杰伦", "八度空间", "博德曼 BMG", "10", "下跌", "8", "8", "1", "0.8 %"); DataFields[10] = new Array("酷玩乐团", "玩过头", "科艺百代 EMI", "11", "上升", "16", "2", "11", "0.7 %"); DataFields[11] = new Array("张震岳", "等我有一天", "魔岩 Magicstone", "12", "新进榜", "-", "1", "12", "0.6 %"); DataFields[12] = new Array("堂本刚", "红与蓝", "艾回 Avex", "13", "新进榜", "-", "1", "13", "0.6 %"); DataFields[13] = new Array("ENERGY", "COME ON", "环球 Universal", "14", "下跌", "10", "9", "5", "0.6 %"); DataFields[14] = new Array("陈冠希", "TRANSITION", "艾回 Avex", "15", "下跌", "9", "3", "5", "0.4 %"); DataFields[15] = new Array("合辑", "MTV 嘻哈大师", "环球 Universal", "16", "下跌", "12", "3", "12", "0.4 %"); </script> <script language='JavaScript'> var BoxWidth = 480; // 资料表显示宽度 ( 不含卷轴 ) var ShowLine = 10; // 资料表显示列数 var RsHeight = 21; // 资料列高度 var LockCols = 1; // 要锁定的栏位数 ( 由左至右 ) function WriteTable() { // 写入表格 var iBoxWidth = BoxWidth; var NewHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><div style=\"width: 100 % ;overflow - x: scroll\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>" for (i = 0; i < DataTitles.length; i++) { if (i < LockCols) { var cTitle = DataTitles[i].split("#"); iBoxWidth -= cTitle[1]; var DynTip = ((i + 1) == LockCols) ? "解除锁定" : "锁定此栏位"; NewHTML += "<td><div class=\"title\" style=\"width: "+cTitle[1]+"px;height: "+RsHeight+"px\" title=\""+DynTip+"\" onclick=\"ResetTable("+i+")\">" + cTitle[0] + "</div></td>" } } NewHTML += "</tr><tr><td colspan=\""+LockCols+"\"><div id=\"DataFrame1\" style=\"position: relative;width: 100 % ;overflow: hidden\"><div id=\"DataGroup1\" style=\"position: relative\"></div></div></td></tr></table></div></td><td valign=\"top\"><div style=\"width: "+iBoxWidth+"px;overflow - x: scroll\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>" for (i = 0; i < DataTitles.length; i++) { if (i >= LockCols) { var cTitle = DataTitles[i].split("#") ; NewHTML += "<td><div class=\"title\" style=\"width: "+cTitle[1]+"px;height: "+RsHeight+"px\" title=\"锁定此栏位\" onclick=\"ResetTable("+i+")\">" + cTitle[0] + "</div></td>" } } NewHTML += "</tr><tr><td colspan=\""+(DataTitles.length-LockCols)+"\"><div id=\"DataFrame2\" style=\"position: relative;width: 100 % ;overflow: hidden\"><div id=\"DataGroup2\" style=\"position: relative\"></div></div></td></tr></table></div></td><td valign=\"top\"><div id=\"DataFrame3\" style=\"position: relative;background: #000;overflow-y:scroll\" onscroll=\"SYNC_Roll()\"><div id=\"DataGroup3\" style = \"position:relative;width:1px;visibility:hidden\"></div></div></td></tr></table>" DataTable.innerHTML = NewHTML; ApplyData(); } function ApplyData() { // 写入资料 var NewHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; for (i = 0; i < DataFields.length; i++) { NewHTML += "<tr>"; for (j = 0; j < DataTitles.length; j++) { if (j < LockCols) { var cTitle = DataTitles[j].split("#"); NewHTML += "<td><div class=\"cdata\" style=\"width: "+cTitle[1]+"px;height: "+RsHeight+"px;text - align: "+cTitle[2]+"\">" + DataFields[i][j] + "</div></td>"; } } NewHTML += "</tr>" } NewHTML += "</table>" DataGroup1.innerHTML = NewHTML var NewHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" for (i = 0; i < DataFields.length; i++) { NewHTML += "<tr>" for (j = 0; j < DataTitles.length; j++) { if (j >= LockCols) { var cTitle = DataTitles[j].split("#"); NewHTML += "<td><div class=\"cdata\" style=\"width: "+cTitle[1]+"px;height: "+RsHeight+"px;text - align: "+cTitle[2]+"\">" + DataFields[i][j] + "</div></td>" } } NewHTML += "</tr>"; } NewHTML += "</table>"; DataGroup2.innerHTML = NewHTML; DataFrame1.style.pixelHeight = RsHeight * ShowLine; DataFrame2.style.pixelHeight = RsHeight * ShowLine; DataFrame3.style.pixelHeight = RsHeight * ShowLine + RsHeight; DataGroup3.style.pixelHeight = RsHeight * (DataFields.length + 1); } function ResetTable(n) { var iBoxWidth = 0 for (i = 0; i < DataTitles.length; i++) { if (i < (n + 1)) { var cTitle = DataTitles[i].split("#"); iBoxWidth += parseInt(cTitle[1]); } } if (iBoxWidth > BoxWidth) { var Sure = confirm("\n锁定栏位的宽度大於资料表显示的宽 \n\n度,这可能会造成版面显示不正常。\n\n\n您确定要继续吗?") } else { Sure = true } if (Sure) { LockCols = (LockCols == n + 1) ? 0 : n + 1; WriteTable(); } } function SYNC_Roll() { DataGroup1.style.posTop = -DataFrame3.scrollTop; DataGroup2.style.posTop = -DataFrame3.scrollTop; } window.onload = WriteTable; </script> <meta content="MSHTML 6.00.2900.2912" name='GENERATOR'> </head> <body> <center> <h4>锁定表格栏位范例网页</h4> <!--// 资料表 ( 开始 ) //--> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td style="BORDER-RIGHT: white 2px inset; BORDER-TOP: white 2px inset; BORDER-LEFT: white 2px inset; BORDER-BOTTOM: white 2px inset; BACKGROUND-COLOR: scrollbar"> <div id='DataTable'> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td> <div style="OVERFLOW-X: scroll; WIDTH: 100%"> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td> <div class='title' title='解除锁定' style="WIDTH: 90px; HEIGHT: 21px" onclick='ResetTable(0)'> 歌手 / 团体 </div> </td> </tr> <tr> <td> <div id='DataFrame1' style="OVERFLOW: hidden; WIDTH: 100%; POSITION: relative; HEIGHT: 210px"> <div id='DataGroup1' style="POSITION: relative"> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 萧亚轩 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 张惠妹 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 陶吉吉 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> S.H.E </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 艾薇儿 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 任贤齐 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 范逸臣 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 谢霆锋 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 周蕙 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 周杰伦 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 酷玩乐团 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 张震岳 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 堂本刚 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> ENERGY </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 陈冠希 </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 90px; HEIGHT: 21px; TEXT-ALIGN: left"> 合辑 </div> </td> </tr> </tbody> </table> </div> </div> </td> </tr> </tbody> </table> </div> </td> <td valign='top'> <div style="OVERFLOW-X: scroll; WIDTH: 390px"> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td> <div class='title' title='锁定此栏位' style="WIDTH: 130px; HEIGHT: 21px" onclick='ResetTable(1)'> 专辑名称 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 110px; HEIGHT: 21px" onclick='ResetTable(2)'> 发行公司 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 58px; HEIGHT: 21px" onclick='ResetTable(3)'> 本周排名 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 58px; HEIGHT: 21px" onclick='ResetTable(4)'> 排名状况 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 58px; HEIGHT: 21px" onclick='ResetTable(5)'> 上周排名 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 58px; HEIGHT: 21px" onclick='ResetTable(6)'> 上榜周数 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 58px; HEIGHT: 21px" onclick='ResetTable(7)'> 最高名次 </div> </td> <td> <div class='title' title='锁定此栏位' style="WIDTH: 70px; HEIGHT: 21px" onclick='ResetTable(8)'> 销售百分比 </div> </td> </tr> <tr> <td colspan='8'> <div id='DataFrame2' style="OVERFLOW: hidden; WIDTH: 100%; POSITION: relative; HEIGHT: 210px"> <div id='DataGroup2' style="POSITION: relative"> <table cellspacing='0' cellpadding='0' border='0'> <tbody> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 爱的主打歌-吻 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 维京 Virgin </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 持平 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 2.9 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 发烧 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 华纳 Warner </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 持平 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 2.1 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 黑色柳丁 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 全员集合 Shock </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 3 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 持平 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 3 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 1.8 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 美丽新世界 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 华研 HIM </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 4 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 持平 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 4 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 6 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 1.2 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 展翅高飞 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 博德曼 BMG </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 新进榜 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> - </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 1.1 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 一个任贤齐 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 滚石 Rock </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 6 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 新进榜 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> - </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 6 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 1.0 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 范逸臣第一张专辑 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 丰华 Forward </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 7 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 持平 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 7 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 7 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.9 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 无形的他全精选 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 新力 Sony </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 8 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 6 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 4 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 4 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.9 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 寂寞城市 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 福茂 Decca </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 9 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 3 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.8 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 八度空间 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 博德曼 BMG </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 10 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 8 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 8 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.8 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 玩过头 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 科艺百代 EMI </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 11 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 上升 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 16 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 2 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 11 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.7 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 等我有一天 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 魔岩 Magicstone </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 12 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 新进榜 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> - </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 12 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.6 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> 红与蓝 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 艾回 Avex </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 13 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 新进榜 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> - </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 1 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 13 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.6 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> COME ON </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 环球 Universal </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 14 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 10 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 9 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.6 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> TRANSITION </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 艾回 Avex </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 15 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 9 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 3 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 5 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.4 % </div> </td> </tr> <tr> <td> <div class='cdata' style="WIDTH: 130px; HEIGHT: 21px; TEXT-ALIGN: left"> MTV 嘻哈大师 </div> </td> <td> <div class='cdata' style="WIDTH: 110px; HEIGHT: 21px; TEXT-ALIGN: left"> 环球 Universal </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 16 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 下跌 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 12 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 3 </div> </td> <td> <div class='cdata' style="WIDTH: 58px; HEIGHT: 21px; TEXT-ALIGN: center"> 12 </div> </td> <td> <div class='cdata' style="WIDTH: 70px; HEIGHT: 21px; TEXT-ALIGN: center"> 0.4 % </div> </td> </tr> </tbody> </table> </div> </div> </td> </tr> </tbody> </table> </div> </td> <td valign='top'> <div id='DataFrame3' style="OVERFLOW-Y: scroll; BACKGROUND: #000; POSITION: relative; HEIGHT: 231px" onscroll='SYNC_Roll()'> <div id='DataGroup3' style="VISIBILITY: hidden; WIDTH: 1px; POSITION: relative; HEIGHT: 357px"> </div> </div> </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table> <!--// 资料表 ( 结束 ) //--> <p> 点取栏位标题可重新设定或解除目前的锁定状态 </p> </center> </body> </html> |
用javascript连接access数据库的方法
这几天费了挺大力气在网上查找javascript连接access数据库的方法, 经过整理总结,终于写出一段能够 […]
在客户端注册DLL文件
<html> <head id=”head1″> <me […]
填方格
[code] <html><head><title>填方格</tit […]
填方格游戏
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
<HTML><HEAD> <TITLE>填方格</TITLE> <STYLE type=text/css>BODY { MARGIN-TOP:0px; FONT-SIZE:9pt; MARGIN-LEFT:0px; MARGIN-RIGHT:0px; FONT-FAMILY:"宋体" } A { FONT-WEIGHT:400; FONT-SIZE:13px; COLOR:black; TEXT-DECORATION:none } A:hover { FONT-WEIGHT:400; FONT-SIZE:13px; COLOR:red; TEXT-DECORATION:underline } A:active { FONT:9pt "宋体"; CURSOR:hand; COLOR:#ff0033 } #board { CURSOR:default } #board TD { WIDTH:25px; HEIGHT: 25px } A.cOn { FONT-WEIGHT:bolder; TEXT-DECORATION:none } #article { PADDING-RIGHT:15pt; PADDING-LEFT:5pt; BACKGROUND:white; PADDING-BOTTOM:0px; FONT:12pt Verdana,geneva,arial,sans-serif; COLOR:black; PADDING-TOP:10pt } #article P.start { TEXT-INDENT:0pt } #article P { MARGIN-TOP:0pt; FONT-SIZE:10pt; TEXT-INDENT:12pt } #article #author { MARGIN-BOTTOM:5pt; TEXT-INDENT:0pt; FONT-STYLE:italic } #pageList P { PADDING-TOP:10pt } #article H3 { FONT-WEIGHT:bold } #article DL { FONT-SIZE:10pt } UL { FONT-SIZE:10pt } OL { FONT-SIZE:10pt } </STYLE> <SCRIPT> var tc_user = "isong"; var tc_class = "2"; var tc_union = "*"; var tc_type = "1"; var tc_user; if (tc_user == null) tc_user = ""; function ShowMenu(bMenu) { document.all.idFinder.style.display = (bMenu) ? "none" : "block" document.all.idMenu.style.display = (bMenu) ? "block" : "none" idML.className = (bMenu) ? "cOn" : "cOff" idRL.className = (bMenu) ? "cOff" : "cOn" return false } function addList(url, desc) { if ((navigator.appName == "Netscape") || (parseInt(navigator.appVersion) >= 4)) { var w = window.open("", "_IDHTML_LIST_", "top=0,left=0,width=475,height=150,history=no,menubar=no,status=no,resizable=no"); var d = w.document; if (!w._init) { d.open(); d.write("<TITLE>Loading...</TITLE><EM>Loading...</EM>"); d.close(); d.location.replace("/assist/listing.asp?url=" + escape(url) + "&desc=" + escape(desc)); w.opener = self; window.status = "Personal Assistant (Adding):" + desc; } else { window.status = w.addOption(url, desc); w.focus(); } } else { alert("Your browser does not support the personal assistant."); return false; } } var size = 10; var moves = 0; var off = size * 2; var on = 0; var current = null; function doOver() { if ((event.srcElement.tagName == "TD") && (current != event.srcElement)) { if (current != null) current.style.backgroundColor = current._background; event.srcElement._background = event.srcElement.style.backgroundColor; event.srcElement.style.backgroundColor = "lightgrey"; current = event.srcElement; } } function setColor(el) { if ((el._background == "") || (el._background == null)) { el.style.backgroundColor = "yellow" el._background = "yellow" } else { el.style.backgroundColor = "" el._background = "" } } function countLights() { off = 0; on = 0 for (var x = 0;x < size;x++) for (var y = 0;y < size;y++) { var p = board.rows[x].cells[y] if (p._background == "yellow") on++ else off++ } document.all.on.innerText = on if (off != 0) document.all.off.innerText = off else document.all.off.innerText = "聪明!" return (off == 0) } function doClick() { setColor(current); var cellIdx = current.cellIndex; var rowIdx = current.parentElement.rowIndex; if (rowIdx > 0) setColor(board.rows[rowIdx - 1].cells[cellIdx]) if (rowIdx < size - 1) setColor(board.rows[rowIdx + 1].cells[cellIdx]) if (cellIdx > 0) setColor(board.rows[rowIdx].cells[cellIdx - 1]) if (cellIdx < size - 1) setColor(board.rows[rowIdx].cells[cellIdx + 1]) moves++; document.all.moves.innerText = moves; win = countLights(); if (win) { board.onclick = null; board.onmouseover = null; current.style.background = "yellow"; } } function buildBoard() { var str = "<TABLE ID=board ONSelectSTART=\"return false\" ONCLICK=\"doClick()\" ONMOUSEOVER=\"doOver()\" cellspacing=0 cellpadding=0 border=5>" for (var x = 0;x < size;x++) { str += "<TR>"; for (var y = 0;y < size;y++) { str += "<TD>?</TD>" } str += "</TR>" } str += "</TABLE>" return str } function newGame() { size = document.all.gameSize.value if (size < 3) size = 3 if (size > 15) size = 15; document.all.gameSize.value = size; document.all.board.outerHTML = buildBoard(); moves = 0; document.all.moves.innerText = moves; countLights(); } </SCRIPT><br> <center><br> <br> <center> <table style="FONT-SIZE:9pt" bordercolor='#8fcfef' border='5' borderlight="green"> <tbody> <tr> <td align='middle'> <p align='center'> <font color='red' size='6'>填 方 格</font> </p> </td> </tr> <tr> <td align='middle' height='100'> <p align='center'> <font><br> 在方格上点击,你可以将下面的方格全部填成</font><font style="FONT-SIZE:9pt" color='#ffff00'>黄色</font><font style="FONT-SIZE:9pt" color='#ffffff'>吗</font><font color='#ff0000'>?</font> </p> <p align='center'> <font>快开动你智慧脑筋,看看有什么技巧与规律。<br> <br> </font> </p> <table cellspacing='0' cellpadding='0' width="100%" bgcolor='#8fcfef' border='0'> <tbody> <tr> <td width="50%"> <div align='right'> <table id='score' style="FONT-SIZE:9pt" width='284' border='0'> <tbody> <tr> <td width='52'> 移动: </td> <td id='moves' width='33'> 0 </td> <td width='42'> 灯灭: </td> <td id='off' width='36'> 25 </td> <td width='46'> 灯亮: </td> <td id='on' width='39'> 0 </td> </tr> </tbody> </table> </div> </td> <td width="50%"> <div align='left'> <table style="FONT-SIZE:9pt" width='204'> <tbody> <tr> <td width='54'> 大小: </td> <td width='41'> <input id='gameSize' style="FONT-SIZE:9pt" size='2' value='10' name='superso.com'> </td> <td width='97'> <input style="FONT-SIZE:9pt" onclick='newGame()' type='button' value='开始游戏'> </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table> <p align='center'> <script>document.write(buildBoard()) </script> <br> </p> </td> </tr> </tbody> </table> </center></center> </body> </html> |
俄罗斯方块
[code] <html><head><title></title& […]
24点游戏
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
<html> <head> <title>24点</title> <meta content='dlpower@163.com' name='author'> <meta http-equiv='Content-Type' content="text/html; charset=GB2312"> <meta content="MSHTML 6.00.2900.2912" name='GENERATOR'> </head> <body> <br> 计算24点(加、减、乘、除、括号) Javascript版 v1.0<br> <br> <br> <br> <form> 请输入四个数字(1-13):<br> <br> <input size='2' name='fa'><input size='2' name='fb'><input size='2' name='fc'><input size='2' name='fd'><br> <br> <input onclick='javascript:funCount()' type='button' value=" 计算 " name='btn'><input onclick='javascript:funSend()' type='button' value=" 发牌 " name='btsend'> </form> <br> <br> <br> <br> 一副牌(52张)中,任意抽取4张可有1820种不同组合,其中有458个牌组算不出24点。 <br> <br> 二十世纪80年代中期,孙士杰从上海到美国定居。孙士杰有几位邻居是美国人。邻居家<br> 的小孩到他家串门,他没有别的玩具供孩子们玩,就灵机一动,拿出一副扑克来教他们<br> 玩“24点”。谁知,这一玩,竟令美国孩子着了迷。这些孩子又把这种游戏带回家中和<br> 学校,人们发现这种游戏对开发智力十分有益,后来就在全美推广开了。 <script language='JavaScript'> function log(str) { document.write("<br>" + str); } // 生成计算表达式 function genExpress(exp, a, b, c, d, m1, m2, m3) { var exp = exp.replace("a", a); exp = exp.replace("b", b); exp = exp.replace("c", c); exp = exp.replace("d", d); exp = exp.replace("m1", m1); exp = exp.replace("m2", m2); exp = exp.replace("m3", m3); return exp; } var answer = new Array(); //正确答案的表达式 var counter = 0; //答案的个数 //测试表达式是否正确 function test(expn, a, b, c, d, m1, m2, m3) { var exp; var ret; exp = genExpress(expn, a, b, c, d, m1, m2, m3); //生成计算表达式 eval("ret = " + exp); if (ret - 24 < 0.1 && ret - 24 >= 0) { exp = exp.replace(";", ""); exp = replaceAll(exp, "*", "×"); exp = replaceAll(exp, "/", "÷"); var have = false; for (var i = 0; i < counter; i++) { if (exp == answer[i]) { have = true; break; } } if (!have) { answer[counter] = exp; counter++; log("<font color=red><b>" + counter + ":??" + exp + "</b></font>"); } } } function replaceAll(streng, soeg, erstat) { var st = streng; if (soeg.length == 0) return st; var idx = st.indexOf(soeg); while (idx >= 0) { st = st.substring(0, idx) + erstat + st.substr(idx + soeg.length); idx = st.indexOf(soeg); } return st; } var n = new Array(); //四个数字 //接收四个输入框的数字,调用主程序 function funCount() { n[0] = document.forms[0].fa.value; n[1] = document.forms[0].fb.value; n[2] = document.forms[0].fc.value; n[3] = document.forms[0].fd.value; if (n[0] > 0 && n[1] > 0 && n[2] > 0 && n[3] > 0 && n[0] < 14 && n[1] < 14 && n[2] < 14 && n[3] < 14) { log("<font size=5><b>" + n[0] + ", " + n[1] + ", " + n[2] + ", " + n[3] + "的24点答案:</b></font><br>"); log("<input type='button' onclick='history.back();' value=' 再来一次 '><br>"); funMain(); if (counter == 0) { log("没有答案!"); } } else { alert("输入错误!"); } } function funSend() { var a = new Array(); a[0] = document.forms[0].fa; a[1] = document.forms[0].fb; a[2] = document.forms[0].fc; a[3] = document.forms[0].fd; for (var i = 0; i < 4; i++) { a[i].value = parseInt(Math.random() * 13 + 1); } } //主程序 function funMain() { var m = new Array(); //四种运算符 m[0] = "+"; m[1] = "-"; m[2] = "*"; m[3] = "/"; //11种表达式 var exp1 = "a m1 b m2 c m3 d;"; var exp2 = "(a m1 b) m2 c m3 d;"; var exp3 = "(a m1 b m2 c) m3 d;"; var exp4 = "((a m1 b) m2 c) m3 d;"; var exp5 = "(a m1 (b m2 c)) m3 d;"; var exp6 = "a m1 (b m2 c) m3 d;"; var exp7 = "a m1 (b m2 c m3 d);"; var exp8 = "a m1 ((b m2 c) m3 d);"; var exp9 = "a m1 (b m2 (c m3 d));"; var exp10 = "a m1 b m2(c m3 d);"; var exp11 = "(a m1 b) m2 (c m3 d);"; var a, b, c, d; //四个数字 var m1, m2, m3; //三个运算符 for (var i = 0; i < 4; i++) { a = n[i]; for (var j = 0; j < 4; j++) { if (i == j) break; //从未选的三个数字中选择一个数字 b = n[j]; for (var x = 0; x < 4; x++) { if (j == x) break; //从未选的两个数字中选择一个数字 c = n[x]; for (var y = 0; y < 4; y++) { if (x == y) break; //从未选的一个数字中选择一个数字 d = n[y]; for (var ta = 0; ta < 4; ta++) { m1 = m[ta]; for (var tb = 0; tb < 4; tb++) { m2 = m[tb]; for (var tc = 0; tc < 4; tc++) { m3 = m[tc]; for (var k = 1; k < 11; k++) { eval("test(exp" + k + ",a,b,c,d,m1,m2,m3);"); } } } } } } } } } </script> </body> </html> |