[html] ? ?<script> ?// 修改编辑栏高度 ?function admin_Si […]
关于javascript的删除确认的几种实现
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 |
<script language="JavaScript"> function delete_confirm(e) { if (event.srcElement.outerText == "删除") event.returnValue = confirm("您确认执行删除操作么?"); } document.onclick = delete_confirm; </script> //可以实现对链接删除的确认,即"删除"两字链接 <script language="JavaScript"> function delete_confirm(e) { if (event.srcElement.value == "删除") event.returnValue = confirm("您确认执行删除操作么?"); } document.onclick = delete_confirm; </script> //可以实现对按钮删除的确认 <script language="JavaScript"> function delete_confirm(e) { if (event.srcElement.value == "删除") event.returnValue = confirm("您确认执行删除操作么?"); else if (event.srcElement.outerText == "删除") event.returnValue = confirm("您确认执行删除操作么?"); } document.onclick = delete_confirm; </script> //实现对链接或按钮删除的确认 <script language="JavaScript"> function delete_confirm(e) { if (event.srcElement.outerText == "删除" || event.srcElement.value == "删除") event.returnValue = confirm("删除后将不能恢复,您确认执行删除操作么?"); } document.onclick = delete_confirm; </script> |
下拉菜单
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 |
<style rel='stylesheet' type='text/css'> BODY { BORDER-BOTTOM:0px; BORDER-LEFT:0px; BORDER-RIGHT:0px; BORDER-TOP:0px; MARGIN:0px } #menu { BACKGROUND:buttonface; BORDER-BOTTOM:buttonface 1px solid; BORDER-LEFT:buttonface 1px solid; BORDER-RIGHT:buttonface 1px solid; BORDER-TOP:buttonface 1px solid; CURSOR:default; LEFT:0px; POSITION:absolute; TOP:0px } #menu .menu { BACKGROUND:buttonface; BORDER-BOTTOM:buttonhighlight 2px outset; BORDER-LEFT:buttonhighlight 2px outset; BORDER-RIGHT:buttonhighlight 2px outset; BORDER-TOP:buttonhighlight 2px outset; POSITION:absolute } #menu TD { FONT:menu; HEIGHT:20px } #menu .root { BORDER-BOTTOM:buttonface 1px solid; BORDER-LEFT:buttonface 1px solid; BORDER-RIGHT:buttonface 1px solid; BORDER-TOP:buttonface 1px solid; MARGIN:6px; PADDING-BOTTOM:1px; PADDING-LEFT:7px; PADDING-RIGHT:7px; PADDING-TOP:1px } #menu .icon { TEXT-ALIGN:center } #menu .disabled { COLOR:buttonshadow } #menu .more { FONT-FAMILY:webdings; TEXT-ALIGN:right; WIDTH:20px } #menu #handle { BORDER-BOTTOM:buttonshadow 1px solid; BORDER-LEFT:buttonhighlight 1px solid; BORDER-RIGHT:buttonshadow 1px solid; BORDER-TOP:buttonhighlight 1px solid; CURSOR:move; MARGIN:0px; PADDING-BOTTOM:0px; PADDING-LEFT:0px; PADDING-RIGHT:0px; PADDING-TOP:0px } #outerDiv { BORDER-BOTTOM:white 2px inset; BORDER-LEFT:white 2px inset; BORDER-RIGHT:white 2px inset; BORDER-TOP:white 2px inset; HEIGHT:90%; OVERFLOW:auto; POSITION:absolute; WIDTH:100%; Z-INDEX: -1 } </style> <script type='text/javascript'> var activeMenu = null; var activeSub = null; var tempEl; var t; var hideWindowedControls = true; var ie5 = (document.getElementsByTagName != null); //////////////////////////////////////////////////////// //If you wan't different colors than default overload these functions... function menuItemHighlight(el) { el.style.background = "highlight"; el.style.color = "highlighttext"; } function menuItemNormal(el) { el.style.background = ""; el.style.color = ""; } function raiseButton(el) { el.style.borderTop = "1 solid buttonhighlight"; el.style.borderLeft = "1 solid buttonhighlight"; el.style.borderBottom = "1 solid buttonshadow"; el.style.borderRight = "1 solid buttonshadow"; el.style.padding = "1"; el.style.paddingLeft = "7"; el.style.paddingRight = "7"; } function normalButton(el) { el.style.border = "1 solid buttonface"; el.style.padding = "1"; el.style.paddingLeft = "7"; el.style.paddingRight = "7"; } function pressedButton(el) { el.style.borderTop = "1 solid buttonshadow"; el.style.paddingTop = "2"; el.style.borderLeft = "1 solid buttonshadow"; el.style.paddingLeft = "8"; el.style.borderBottom = "1 solid buttonhighlight"; el.style.paddingBottom = "0"; el.style.borderRight = "1 solid buttonhighlight"; el.style.paddingRight = "6"; } //...untill here //////////////////////////////////////////////////////// function cleanUpMenuBar() { for (i = 0; i < menu.rows.length; i++) { for (j = 0; j < menu.rows(i).cells.length; j++) { if (menu.rows(i).cells(j).className == "root") { normalButton(menu.rows(i).cells(j)); } } } showWindowedObjects(true); } function getMenuItem(el) { temp = el; while ((temp != null) && (temp.tagName != "TABLE") && (temp.id != "menubar") && (temp.id != "menu") && (temp.id != "handle")) { if ((temp.tagName == "TR") || (temp.className == "root")) el = temp; temp = temp.parentElement; } return el; } function getSub(el) { temp = el; while ((temp != null) && (temp.className != "sub")) { i f(temp.tagName == "TABLE") el = temp; temp = temp.parentElement; } return el; } function menuClick() { if (event.srcElement == null) return; var el = getMenuItem(event.srcElement); if ((el.className != "disabled") && (el.id != "menubar")) { if (el.className == "root") { if (activeMenu) { raiseButton(el); showWindowedObjects(true); } else pressedButton(el); toggleMenu(el); } else if (el.href) { cleanUpMenuBar(); if (activeMenu) toggleMenu(activeMenu.parentElement); if (el.target) window.open(el.href, el.target); else if (document.all.tags("BASE").item(0) != null) window.open(el.href, document.all.tags("BASE").item(0).target); else window.location = el.href; } } window.event.cancelBubble = true; } //////////////////////////////////////////////////////// // Used to hide the menu when clicked elsewhere function Restore() { if (activeMenu) { toggleMenu(activeMenu.parentElement); cleanUpMenuBar(); } } document.onclick = Restore; //////////////////////////////////////////////////////// function menuOver() { if ((event.fromElement == null) || (event.toElement == null) || (event.fromElement == event.toElement)) return; var fromEl = getMenuItem(event.fromElement); var toEl = getMenuItem(event.toElement); if (fromEl == toEl) return; if ((toEl.className != "disabled") && (toEl.id != "menubar")) { if (toEl.className == "root") { if (activeMenu) { if (toEl.menu != activeMenu) { cleanUpMenuBar(); pressedButton(toEl); toggleMenu(toEl); } } else { raiseButton(toEl); } } else { if ((fromEl != toEl) && (toEl.tagName != "TABLE")) { cleanup(toEl.parentElement.parentElement, false); menuItemHighlight(toEl); toEl.parentElement.parentElement.activeItem = toEl; if (toEl.href) window.status = toEl.href; if (toEl.className == "sub") showSubMenu(toEl, true); } } } } function menuOut() { if ((event.fromElement == null) || (event.toElement == null) || (event.fromElement == event.toElement)) return; var fromEl = getMenuItem(event.fromElement); var toEl = getMenuItem(event.toElement); if (fromEl == toEl) return; if (fromEl.className == "root") { if (activeMenu) { if (fromEl.menu != activeMenu) normalButton(fromEl); } else normalButton(fromEl); } else { if ((fromEl.className != "disabled") && (fromEl.id != "menubar")) { if ((fromEl.className == "sub") && (getSub(toEl) == fromEl.subMenu) || (fromEl.subMenu == toEl.parentElement.parentElement)) return; else if ((fromEl.className == "sub")) { cleanup(fromEl.subMenu, true); menuItemNormal(fromEl); } else if ((fromEl != toEl) && (fromEl.tagName != "TABLE")) menuItemNormal(fromEl); window.status = ""; } } } function toggleMenu(el) { if (el.menu == null) el.menu = getChildren(el); if (el.menu == activeMenu) { if (activeSub) menuItemNormal(activeSub.parentElement.parentElement); cleanup(el.menu, true); activeMenu = null; activeSub = null; // showWindowedObjects(true); } else { if (activeMenu) { cleanup(activeMenu, true); hideMenu(activeMenu); } activeMenu = el.menu; var tPos = topPos(el.menu) + menu.offsetHeight; if ((document.body.offsetHeight - tPos) >= el.menu.offsetHeight) { el.menu.style.pixelTop = (ie5) ? el.offsetHeight + 1 : menu.offsetHeight - el.offsetTop - 2; dir = 2; } else { el.menu.style.pixelTop = (ie5) ? el.offsetTop - el.menu.offsetHeight - 1 : el.offsetTop - el.menu.offsetHeight + 2; dir = 8; } el.menu.style.pixelLeft = (ie5) ? el.offsetLeft - 2 : el.offsetLeft; show(el.menu, dir); showWindowedObjects(false); } } function showSubMenu(el, show) { var dir = 2; temp = el; list = el.children.tags("TD"); el = list[list.length - 1]; if (el.menu == null) el.menu = getChildren(el); temp.subMenu = el.menu; if ((el.menu != activeMenu) && (show)) { activeSub = el.menu; var lPos = leftPos(el.menu); if ((document.body.offsetWidth - lPos) >= el.menu.offsetWidth) { el.menu.style.left = (ie5) ? el.parentNode.offsetWidth : el.offsetParent.offsetWidth; dir = 6; } else { el.menu.style.left = -el.menu.offsetWidth + 3; dir = 4; } var tPos = (ie5) ? topPos(el.menu) + el.offsetTop : topPos(el.menu) + el.offsetParent.offsetTop; // + el.menu.offsetTop; if ((document.body.offsetHeight - tPos) >= el.menu.offsetHeight) el.menu.style.top = (ie5) ? el.offsetTop - 4 : el.offsetParent.offsetTop - 2; else el.menu.style.top = (ie5) ? el.offsetTop + el.offsetHeight - el.menu.offsetHeight : el.offsetParent.offsetTop + el.offsetParent.offsetHeight - el.menu.offsetHeight + 2; showSub(el.menu, dir); } else { show(el.menu, dir); activeSub = null; } } //////////////////////////////////////////////////////// //The following two functions are needed to calculate the position function topPos(el) { var temp = el; var y = 0; while (temp.id != "menu") { temp = temp.offsetParent; y += temp.offsetTop; } return y; } function leftPos(el) { var temp = el; var x = 0; while (temp.id != "menu") { temp = temp.offsetParent; x += temp.offsetLeft; } return x + el.offsetParent.offsetWidth; } //////////////////////////////////////////////////////// function show(el, dir) { if (typeof (fade) == "function") fade(el, true); else if (typeof (swipe) == "function") { tempElSwipe = el; tempDirSwipe = dir; el.style.visibility = "visible"; el.style.visibility = "hidden"; window.setTimeout("tempSwipe()", 0); // swipe(el, dir); } else el.style.visibility = "visible"; } var tempElSwipe, tempDirSwipe; function tempSwipe() { swipe(tempElSwipe, tempDirSwipe); } function showSub(el, dir) { show(el, dir); // swipe(el, dir); // fade(el, true); // el.style.visibility = "visible"; } function cleanup(menu, hide) { if (menu.activeItem) { //If you've been here before if ((menu.activeItem.className == "sub") && (menu.activeItem.subMenu)) { //The active item has a submenu cleanup(menu.activeItem.subMenu, true); //Clean up the subs as well } menuItemNormal(menu.activeItem); } if (hide) { hideMenu(menu); } } function hideMenu(el) { if (typeof (fade) == "function") { fade(el, false); // window.setTimeout(fadeTimer); } else if (typeof (swipe) == "function") { hideSwipe(el); } else el.style.visibility = "hidden"; } function getChildren(el) { var tList = el.children.tags("TABLE"); return tList[0]; } ///////////////////////////////////////////////////////////////////////////// // The rest is just for the moving/docking var dragObject = null; var dragObjectPos = "top"; var tx; var ty; ///////////////////////////////////////////////////////////////////////////// // Fixing sizes and positions window.onload = fixSize; window.onresize = fixSize; function fixSize() { if (dragObjectPos == "top") { outerDiv.style.top = menu.offsetHeight; outerDiv.style.height = document.body.clientHeight - menu.offsetHeight; } else if (dragObjectPos == "bottom") { outerDiv.style.top = 0; outerDiv.style.height = document.body.clientHeight - menu.offsetHeight; menu.style.top = document.body.clientHeight - menu.offsetHeight; } else { outerDiv.style.top = 0; outerDiv.style.height = document.body.clientHeight; } } ///////////////////////////////////////////////////////////////////////////// function document.onmousedown() { if (window.event.srcElement.id == "handle") { dragObject = document.all[window.event.srcElement.getAttribute("for")]; Restore(); //Hide the menus while moving ty = (window.event.clientY - dragObject.style.pixelTop); window.event.returnValue = false; window.event.cancelBubble = true; } else { dragObject = null; } } function document.onmouseup() { if (dragObject) { dragObject = null; } } function document.onmousemove() { if (dragObject) { if (window.event.clientX >= 0) { if ((window.event.clientY - ty) <= 15) { dragObject.style.border = "0 solid buttonface"; dragObject.style.width = "100%"; dragObject.style.top = 0; dragObject.style.left = 0; dragObjectPos = "top"; fixSize(); } else if ((window.event.clientY - ty) >= document.body.clientHeight - menu.offsetHeight - 15) { dragObject.style.border = "0 solid buttonface"; dragObject.style.width = "100%"; dragObject.style.top = document.body.clientHeight - menu.offsetHeight; dragObject.style.left = 0; dragObjectPos = "bottom"; fixSize(); } else { dragObject.style.width = "10px"; dragObject.style.left = window.event.clientX; dragObject.style.top = window.event.clientY - ty; dragObject.style.border = "2px outset white"; dragObjectPos = "float"; fixSize(); } } else { dragObject.style.border = ""; dragObject.style.left = "0"; dragObject.style.top = "0"; } window.event.returnValue = false; window.event.cancelBubble = true; } } //This function si used for hiding windowed controls because they interfere with the menus function showWindowedObjects(show) { if (hideWindowedControls) { var windowedObjectTags = new Array("Select", "IFRAME", "OBJECT", "APPLET", "EMBED"); var windowedObjects = new Array(); var j = 0; for (var i = 0; i < windowedObjectTags.length; i++) { var tmpTags = document.all.tags(windowedObjectTags[i]); if (tmpTags.length > 0) { for (var k = 0; k < tmpTags.length; k++) { windowedObjects[j++] = tmpTags[k]; } } } for (var i = 0; i < windowedObjects.length; i++) { if (!show) windowedObjects[i].visBackup = (windowedObjects[i].style.visibility == null) ? "visible" : windowedObjects[i].style.visibility; windowedObjects[i].style.visibility = (show) ? windowedObjects[i].visBackup : "hidden"; } } } </script> <table cellspacing='1' id='menu' onclick='menuClick()' onmouseout='menuOut()' onmouseover='menuOver()' onselectstart="return false"> <tbody> <tr id='menubar'> <!-- This is a handle. Grab this --> <td class='disabled' style="PADDING-LEFT: 0px; PADDING-RIGHT: 1px"> <div class='disabled' id='handle' style="HEIGHT: 100%; LEFT: 3px; WIDTH: 3px" title="Move me!" for="menu"> </div> </td> <!-- End of handle --> <td class='root'> Demo <table cellspacing='0' class='menu' style="VISIBILITY: hidden"> <tbody> <tr href="javascript:alert('这里可以改成一个链接!')"> <td> <img height='17' src="home.gif" tppabs="http://www.baron.com.cn/javascript/menu/home.gif" width='16'> </td> <td nowrap> You can use icons </td> <td> </td> </tr> <tr class='disabled'> <td> </td> <td nowrap> Disabled menuItems </td> <td> </td> </tr> <tr class='sub'> <td> </td> <td nowrap> Use sub menus </td> <td> <span class='more'>4</span> <table cellspacing='0' class='menu' style="VISIBILITY: hidden"> <tbody> <tr href="javascript:alert('这里可以改成一个链接')"> <td nowrap style="HEIGHT: 20px"> Inside a sub menu </td> </tr> </tbody> </table> </td> </tr> <tr class='disabled'> <td colspan='3'> <hr/> </td> </tr> <tr href="javascript:alert('这里可以改成一个链接')"> <td> </td> <td> Use separators </td> <td> </td> </tr> <tr title="This is really easy"> <td> </td> <td> Use tool tip </td> <td> </td> </tr> </tbody> </table> </td> <!-- Leave this About --> <td class='root'> Help <table cellspacing='0' class='menu' style="VISIBILITY: hidden"> <tbody> <tr class='sub'> <td> <span style="WIDTH: 20px"></span> </td> <td> About </td> <td> <span class='more'>4</span> <table cellspacing='0' class='menu' style="BACKGROUND: black; VISIBILITY: hidden"> <tbody> <tr class='disabled' title=""> <td> <div style="BACKGROUND: black; COLOR: white; FONT-FAMILY: verdana; FONT-SIZE: 12px; MARGIN: 5px; PADDING-BOTTOM: 5px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px; WIDTH: 200px"> <p style="MARGIN : 5px"> 站长<span style="COLOR: tomato; FONT-WEIGHT: bold">晨曦</span> 欢迎你的光临<a href="mailto:xiaoqinglu@263.net" style="COLOR: white">ChengXi</a>. </p> <p style="BACKGROUND: beige; COLOR: red; FONT-SIZE: 9px; MARGIN: 10px"> 这个菜单只适用与IE4.0或更高版本 </p> <p onclick="bugs.style.display=(bugs.style.display=='')?'none':'';" style="CURSOR: hand; TEXT-DECORATION: underline"> 欢迎再次光临! </p> <p id='bugs' style="DISPLAY: none; MARGIN-LEFT: 20px; MARGIN-TOP: -5px"> www.javascript2000.com 是最大的中文javascript站点 并且每日更新,你一定不可错过 </p> <hr style="COLOR: deepskyblue"> <p style="MARGIN-BOTTOM: -10px; MARGIN-LEFT: 33px; MARGIN-TOP: -12px"> <a href="javascript:if(confirm('http://www.javascript2000.com/ /n/n文件并未依 Teleport Pro 取回,因为 它的域或路径超过开始网址中设置的范围。 /n/n你要从服务器上打开它吗?'))window.location='http://www.javascript2000.com/'" tppabs="http://www.javascript2000.com/" style="COLOR: white; FONT-FAMILY: arial black; FONT-SIZE: 30px; FONT-STYLE: italic; TEXT-DECORATION: none" target='_top'>javascript2000</a> </p> </div> </td> </tr> </tbody> </table> </td> <!-- Till here --> </tr> </tbody> </table> </td> <td class='disabled' width="100%"> </td> </tr> </tbody> </table> <div id='outerDiv'></div> |
Ajax应用:异步获取历史上的今天
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 |
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>Ajax应用:异步获取历史上的今天</title> <script language="javascript"> //Ajax远程获取滚动条样式 var http_request = false; function makeRequest(url) { http_request = false; //Loading提示: document.getElementById("historyText").innerHTML = "正在读取…"; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType("text/xml"); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { document.getElementById("historyText").innerHTML = "无法创建XMLHTTP实例!"; //alert("Giving up :( Cannot create an XMLHTTP instance"); return false; } d = new Date(); // 创建 Date 对象。 s = "temp"; s += d.getYear(); // 获取年份。 s += d.getMonth() + 1; // 获取月份。 s += d.getDate(); // 获取日。 s += d.getHours(); // 获取小时。 s += d.getMinutes(); // 获取分钟。 s += d.getSeconds(); // 获取秒数。 url = "todayOnHistory_Proxy.asp?tempVar=" + s; http_request.onreadystatechange = alertContents; http_request.open("GET", url, true); http_request.send(null); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { document.getElementById("historyText").innerHTML = http_request.responseText; } else { document.getElementById("historyText").innerHTML = "数据读取失败!"; } } } </script> <style type="text/css"> body,td{font-size:14px;color:#000000;} a:link,a:visited{font-size:14px;color:#000000; text-decoration:underline} a:hover{font-size:14px;color:#0046D5; text-decoration:underline} .style22{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #DEDEB8; background-color: #FDFFF2 } </style> </head> <body onload="makeRequest()"> <fieldset style="width:400px"> <legend>Today on history:</legend> <div id="historyText" style="padding:10px"> </div> </fieldset> </body> </html> |
JavaScript生产MD5码
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 |
<label> 明文 <input id='iput' value='admin888' maxlength="40" size="44"> </label> <label> 密文 <input id='oput' value="" maxlength="40" size="44"> </label> <input type='button' value='生成16位md5密码' id='md5_16' onclick="javascript:oput.value=calcMD5(iput.value,16)"> <input type='button' value='生成32位md5密码' id='md5_32' onclick="javascript:oput.value=calcMD5(iput.value,32)"> <script> /* * * * * * * * * * * * * * * * * * * * md5.js * * A JavaScript implementation of the RSA Data Security, Inc.MD5 * Message - Digest Algorithm. * * Copyright(C) Paul Johnston 1999.Distributed under the LGPL. * * * * * * * */ / * to convert strings to a list of ascii values * / var sAscii = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; var sAscii = sAscii + "[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; /* convert integer to hex string */ var sHex = "0123456789ABCDEF"; function hex(i) { h = ""; for (j = 0; j <= 3; j++) { h += sHex.charAt((i >> (j * 8 + 4)) & 0x0F) + sHex.charAt((i >> (j * 8)) & 0x0F); } return h; } /* add, handling overflows correctly */ function add(x, y) { return ((x & 0x7FFFFFFF) + (y & 0x7FFFFFFF)) ^ (x & 0x80000000) ^ (y & 0x80000000); } /* MD5 rounds functions */ function R1(A, B, C, D, X, S, T) { q = add(add(A, (B & C) | (~B & D)), add(X, T)); return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B); } function R2(A, B, C, D, X, S, T) { q = add(add(A, (B & D) | (C & ~D)), add(X, T)); return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B); } function R3(A, B, C, D, X, S, T) { q = add(add(A, B ^ C ^ D), add(X, T)); return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B); } function R4(A, B, C, D, X, S, T) { q = add(add(A, C ^ (B | ~D)), add(X, T)); return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B); } /* main entry point */ function calcMD5(sInp, typemd5) { /* Calculate length in machine words, including padding */ wLen = (((sInp.length + 8) >> 6) + 1) << 4; var X = new Array(wLen); /* Convert string to array of words */ j = 4; for (i = 0; (i * 4) < sInp.length; i++) { X[i] = 0; for (j = 0;(j < 4) && ((j + i * 4) < sInp.length); j++) { X[i] += (sAscii.indexOf(sInp.charAt((i * 4) + j)) + 32) << (j * 8); } } /* Append padding bits and length */ if (j == 4) { X[i++] = 0x80; } else { X[i - 1] += 0x80 << (j * 8); } for (; i < wLen; i++) { X[i] = 0; } X[wLen - 2] = sInp.length * 8; /* hard-coded initial values */ a = 0x67452301; b = 0xefcdab89; c = 0x98badcfe; d = 0x10325476; /* Process each 16-word block in turn */ for (i = 0; i < wLen; i += 16) { aO = a; bO = b; cO = c; dO = d; a = R1(a, b, c, d, X[i + 0], 7, 0xd76aa478); d = R1(d, a, b, c, X[i + 1], 12, 0xe8c7b756); c = R1(c, d, a, b, X[i + 2], 17, 0x242070db); b = R1(b, c, d, a, X[i + 3], 22, 0xc1bdceee); a = R1(a, b, c, d, X[i + 4], 7, 0xf57c0faf); d = R1(d, a, b, c, X[i + 5], 12, 0x4787c62a); c = R1(c, d, a, b, X[i + 6], 17, 0xa8304613); b = R1(b, c, d, a, X[i + 7], 22, 0xfd469501); a = R1(a, b, c, d, X[i + 8], 7, 0x698098d8); d = R1(d, a, b, c, X[i + 9], 12, 0x8b44f7af); c = R1(c, d, a, b, X[i + 10], 17, 0xffff5bb1); b = R1(b, c, d, a, X[i + 11], 22, 0x895cd7be); a = R1(a, b, c, d, X[i + 12], 7, 0x6b901122); d = R1(d, a, b, c, X[i + 13], 12, 0xfd987193); c = R1(c, d, a, b, X[i + 14], 17, 0xa679438e); b = R1(b, c, d, a, X[i + 15], 22, 0x49b40821); a = R2(a, b, c, d, X[i + 1], 5, 0xf61e2562); d = R2(d, a, b, c, X[i + 6], 9, 0xc040b340); c = R2(c, d, a, b, X[i + 11], 14, 0x265e5a51); b = R2(b, c, d, a, X[i + 0], 20, 0xe9b6c7aa); a = R2(a, b, c, d, X[i + 5], 5, 0xd62f105d); d = R2(d, a, b, c, X[i + 10], 9, 0x2441453); c = R2(c, d, a, b, X[i + 15], 14, 0xd8a1e681); b = R2(b, c, d, a, X[i + 4], 20, 0xe7d3fbc8); a = R2(a, b, c, d, X[i + 9], 5, 0x21e1cde6); d = R2(d, a, b, c, X[i + 14], 9, 0xc33707d6); c = R2(c, d, a, b, X[i + 3], 14, 0xf4d50d87); b = R2(b, c, d, a, X[i + 8], 20, 0x455a14ed); a = R2(a, b, c, d, X[i + 13], 5, 0xa9e3e905); d = R2(d, a, b, c, X[i + 2], 9, 0xfcefa3f8); c = R2(c, d, a, b, X[i + 7], 14, 0x676f02d9); b = R2(b, c, d, a, X[i + 12], 20, 0x8d2a4c8a); a = R3(a, b, c, d, X[i + 5], 4, 0xfffa3942); d = R3(d, a, b, c, X[i + 8], 11, 0x8771f681); c = R3(c, d, a, b, X[i + 11], 16, 0x6d9d6122); b = R3(b, c, d, a, X[i + 14], 23, 0xfde5380c); a = R3(a, b, c, d, X[i + 1], 4, 0xa4beea44); d = R3(d, a, b, c, X[i + 4], 11, 0x4bdecfa9); c = R3(c, d, a, b, X[i + 7], 16, 0xf6bb4b60); b = R3(b, c, d, a, X[i + 10], 23, 0xbebfbc70); a = R3(a, b, c, d, X[i + 13], 4, 0x289b7ec6); d = R3(d, a, b, c, X[i + 0], 11, 0xeaa127fa); c = R3(c, d, a, b, X[i + 3], 16, 0xd4ef3085); b = R3(b, c, d, a, X[i + 6], 23, 0x4881d05); a = R3(a, b, c, d, X[i + 9], 4, 0xd9d4d039); d = R3(d, a, b, c, X[i + 12], 11, 0xe6db99e5); c = R3(c, d, a, b, X[i + 15], 16, 0x1fa27cf8); b = R3(b, c, d, a, X[i + 2], 23, 0xc4ac5665); a = R4(a, b, c, d, X[i + 0], 6, 0xf4292244); d = R4(d, a, b, c, X[i + 7], 10, 0x432aff97); c = R4(c, d, a, b, X[i + 14], 15, 0xab9423a7); b = R4(b, c, d, a, X[i + 5], 21, 0xfc93a039); a = R4(a, b, c, d, X[i + 12], 6, 0x655b59c3); d = R4(d, a, b, c, X[i + 3], 10, 0x8f0ccc92); c = R4(c, d, a, b, X[i + 10], 15, 0xffeff47d); b = R4(b, c, d, a, X[i + 1], 21, 0x85845dd1); a = R4(a, b, c, d, X[i + 8], 6, 0x6fa87e4f); d = R4(d, a, b, c, X[i + 15], 10, 0xfe2ce6e0); c = R4(c, d, a, b, X[i + 6], 15, 0xa3014314); b = R4(b, c, d, a, X[i + 13], 21, 0x4e0811a1); a = R4(a, b, c, d, X[i + 4], 6, 0xf7537e82); d = R4(d, a, b, c, X[i + 11], 10, 0xbd3af235); c = R4(c, d, a, b, X[i + 2], 15, 0x2ad7d2bb); b = R4(b, c, d, a, X[i + 9], 21, 0xeb86d391); a = add(a, aO); b = add(b, bO); c = add(c, cO); d = add(d, dO); } if (typemd5 == 32) { return hex(a) + hex(b) + hex(c) + hex(d); } if (typemd5 == 16) { return hex(b) + hex(c); } } </script> |
数值计算(4舍5入后取i位小数)
//4舍5入后取i位小数 function selectedPoint(value,i) { return p […]
按键转换(回车输入为Tab输入)
//转换回车输入为Tab输入,转向下一个元素 ?function keyDown(DnEvents){ ? ? […]
窗口操作
//在fmain页面上显示帮助页面 //系统在设计中提供在线帮助,在线帮助为一可以移动的div,在fmain页 […]
鼠标移动经过TR时变色
//鼠标移动经过tr时变色 ?var rowbgcolor = ‘#ffffff’; […]
select元素操作
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 |
//获得select元素当前选中的值 //输入参数:select表单元素 //返回:字符串 //get the value from select that selected function getSelectValue(selobj) { if (selobj.options.length == 0 || selobj.selectedIndex == -1) return null; var str; str = selobj.options[selobj.selectedIndex].value; return str; } //获得select元素当前选中的文本 //输入参数:select表单元素 //返回:字符串 //get the text from select that selected function getSelectText(selobj) { if (selobj.options.length == 0 || selobj.selectedIndex == -1) return null; var str; str = selobj.options[selobj.selectedIndex].text; return str; } function getSelectValueArray(selobj) { var selNums = 0; for (var i = 0; i < selobj.options.length; i++) if (selobj.options[i].selected) selNums++; var options = new Array(selNums); var n = 0; for (var i = 0; i < selobj.options.length; i++) if (selobj.options[i].selected) options[n++] = selobj.options[i].value; return options; } //选中select指定选项,如果不存在不做处理 function selectedOne(selobj, value) { var len = selobj.options.length; if (len == 0) return false; for (i = 0; i < len; i++) { if (selobj.options[i].value == value) selobj.options[i].selected = true; } return true; } |
轮换显示
function exchangeImg(elm,pic1,pic2){ if(elm.src == R […]
字符串操作大全
function trim(str){ if(str==null) return “” […]
显示或者隐藏大全
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 |
//显示隐藏div,该函数应用于checkbox与div动态关联 //用户选中checkbox后div显示,取消选中时div隐藏 //输入参数:checkbox表单元素,div元素 function linkdisplay(checkbox, divID) { if (checkbox.checked) { divID.style.display = "block"; } else divID.style.display = "none"; } //显示/隐藏div元素 //输入参数:div元素 function display(selobj) { if (selobj.length == null) selobj.style.display = "block"; else for (var i = 0; i < selobj.length; i++) selobj[i].style.display = "block"; } function hidden(selobj) { if (selobj.length == null) selobj.style.display = "none"; else for (var i = 0; i < selobj.length; i++) selobj[i].style.display = "none"; } |
自由编辑表格
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 |
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312″> <title> 测试修改表格 </title> <style> /*提示层的样式*/ div { BORDER-RIGHT: #80c144 1px solid; BORDER-TOP: #80c144 1px solid; VISIBILITY: hidden; BORDER-LEFT: #80c144 1px solid; CURSOR: default; LINE-HEIGHT: 20px; BORDER-BOTTOM: #80c144 1px solid; FONT-FAMILY: 宋体; font-size:12px; POSITION: absolute; BACKGROUND-COLOR: #f6f6f6; TOP:30px; LEFT:30px; } /*tr的样式*/ tr { font-family: "宋体"; color: #000000; background-color: #C1DBF5; font-size: 12px } /*table脚注样式*/ .TrFoot { FONT-SIZE: 12px; font-family:"宋体", "Verdana", "Arial"; BACKGROUND-COLOR: #6699CC; COLOR:#FFFFFF; height: 25; } /*trhead属性*/ .TrHead { FONT-SIZE: 13px; font-family:"宋体", "Verdana", "Arial"; BACKGROUND-COLOR: #77AADD; COLOR:#FFFFFF; height: 25; } /*文本框样式*/ INPUT { BORDER-COLOR: #AACEF7 #AACEF7 #AACEF7 #AACEF7; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; FONT-SIZE: 12px; FONT-FAMILY: "宋体","Verdana"; color: #000000; BACKGROUND-COLOR: #E9EFF5; } /*button样式*/ button { BORDER-COLOR: #AACEF7 #AACEF7 #AACEF7 #AACEF7; BACKGROUND-COLOR: #D5E4F3; CURSOR: hand; FONT-SIZE:12px; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; COLOR: #000000; } </style> </head> <body> <script language=" JavaScript"> //标志位,值为false代表未打开一个编辑框,值为true为已经打开一个编辑框开始编辑 var editer_table_cell_tag = false; //开启编辑功能标志,值为true时为允许编辑 var run_edit_flag = false; </script> <script language=" JavaScript"> /** * 编辑表格函数 * 单击某个单元格可以对里面的内容进行自由编辑 * @para tableID 为要编辑的table的id * @para noEdiID 为不要编辑的td的ID,比如说table的标题 * 可以写为<td id="no_editer">自由编辑表格</td> * 此时该td不可编辑 */ function editerTableCell(tableId, noEdiId) { var tdObject = event.srcElement; var tObject = ((tdObject.parentNode).parentNode).parentNode; if (tObject.id == tableId && tdObject.id != noEdiId && editer_table_cell_tag == false && run_edit_flag == true) { tdObject.innerHTML = " < input type = text id = edit_table_txt name = edit_table_txt value = " + tdObject.innerText + "size = '15′onKeyDown = 'enterToTab()' > <input type = button value = '确定'onclick = 'certainEdit()' > "; edit_table_txt.focus(); edit_table_txt.select(); editer_table_cell_tag = true; //修改按钮提示信息 editTip.innerText = "请先点确定按钮确认修改!"; } else { return false; } } /** * 确定修改 */ function certainEdit() { var bObject = event.srcElement; var tdObject = bObject.parentNode; var txtObject = tdObject.firstChild; tdObject.innerHTML = txtObject.value; //代表编辑框已经关闭 editer_table_cell_tag = false; //修改按钮提示信息 editTip.innerText = "请单击某个单元格进行编辑!"; } function enterToTab() { if (event.srcElement.type != 'button' && event.srcElement.type != 'textarea' && event.keyCode == 13) { event.keyCode = 9; } } /** * 控制是否编辑 */ function editStart() { if (event.srcElement.value == "开始编辑") { event.srcElement.value = "编辑完成"; run_edit_flag = true; } else { //如果当前没有编辑框,则编辑成功,否则,无法提交 //必须按确定按钮后才能正常提交 if (editer_table_cell_tag == false) { alert("编辑成功结束!"); event.srcElement.value = "开始编辑"; run_edit_flag = false; } } } /** * 根据不同的按钮提供不同的提示信息 */ function showTip() { if (event.srcElement.value == "编辑完成") { editTip.style.top = event.y + 15; editTip.style.left = event.x + 12; editTip.style.visibility = "visible"; } else { editTip.style.visibility = "hidden"; } } </script> <table id="editer_table" width="100%" align="center" onclick="editerTableCell('editer_table','no_editer')"> <tr class="TrHead"> <td colspan="3″ align="center" id="no_editer">自由编辑表格</td> </tr> <tr> <td width="33%">单击开始编辑按钮,然后点击各单元格编辑</td> <td width="33%">2</td> <td width="33%">3</td> </tr> <tr> <td width="33%">4</td> <td width="33%">5</td> <td width="33%">6</td> </tr> <tr> <td width="33%">one</td> <td width="33%">two</td> <td width="33%">three</td> </tr> <tr> <td width="33%">four</td> <td width="33%">five</td> <td width="33%">six</td> </tr> <tr class="TrFoot"> <td colspan="3″ align="center" id="no_editer"> <input type="button" class="bt" value="开始编辑" onClick="editStart()" onMouseOver="showTip()" onMouseMove="showTip()" onMouseOut="editTip.style.visibility = 'hidden';"> </td> </tr> </table> </body> <div id="editTip">请单击某个单元格进行编辑!</div> </html> |
回车键换为tab
在每个文本框的onblur事件中调用校验代码,并且每个文本框中onKeyDown事件中写一个enter转tab […]
只限制输入数字
具有在输入非数字字符不回显的效果,即对非数字字符的输入不作反应。 [code] function number […]
电话号码的验证
电话号码的验证 要求: (1)电话号码由数字、”(“、”)”和 […]
无边框窗口
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 |
<html XMLNS:IE> <meta http-equiv="Content-Type" content="text/html; charset=gb2312″> <ie:Download ID="include" STYLE="behavior:url(#default#download)" /> <title> Chromeless Window </title> <script LANGUAGE="JScript"> /*— Special Thanks For andot —*/ /* This following code are designed and writen by Windy_sk <seasonx@163.net> You can use it freely, but u must held all the copyright items! */ /*— Thanks For andot Again —*/ var CW_width = 400; var CW_height = 300; var CW_top = 100; var CW_left = 100; var CW_url = " / "; var New_CW = window.createPopup(); var CW_Body = New_CW.document.body; var content = ""; var CSStext = "margin: 1px; color: black; border: 2px outset; border - style: expression(onmouseout = onmouseup = function() { this.style.borderStyle = 'outset' }, onmousedown = function() { if (event.button != 2) this.style.borderStyle = 'inset' }); background - color: buttonface; width: 16px; height: 14px; font - size: 12px; line - height: 11px; cursor: Default;"; //Build Window include.startDownload(CW_url, function(source) { content = source }); function insert_content() { var temp = ""; CW_Body.style.overflow = "hidden"; CW_Body.style.backgroundColor = "white"; CW_Body.style.border = "solid black 1px"; content = content.replace(/<a ([^>]*)>/g, " < a onclick = 'parent.open(this.href); return false'$1 > "); temp += " < table width = 100 % height = 100 % cellpadding = 0 cellspacing = 0 border = 0 > "; temp += " < tr style = '; font - size: 12px; background: #0099CC;height:20;cursor:default' ondblclick="Max.innerText = Max.innerText == '1′ ? '2′ : '1′; parent.if_max = !parent.if_max; parent.show_CW();"onmouseup = 'parent.drag_up(event)'onmousemove = 'parent.drag_move(event)'onmousedown = 'parent.drag_down(event)'onselectstart = ' return false'oncontextmenu = ' return false' > "; temp += " < td style = 'color: #ffffff; padding - left: 5px' > Chromeless Window For IE6 SP1 < /td>"; temp += "<td style='color:#ffffff;padding-right:5px;' align=right>"; temp += "<span id=Help onclick="alert('Chromeless Window For IE6 SP1 – Ver 1.0\n\nCode By Windy_sk\n\nSpecial Thanks For andot')" style=""+CSStext+"font-family:System;padding-right:2px;">?</span > "; temp += " < span id = Min onclick = 'parent.New_CW.hide(); parent.blur()'style = ""+CSStext+"font-family:Webdings;" title='Minimum'>0</span>"; temp += "<span id=Max onclick="this.innerText=this.innerText=='1′?'2′:'1′;parent.if_max=!parent.if_max;parent.show_CW();" style="" + CSStext + "font - family: Webdings;"title = 'Maximum' > 1 < /span>"; temp += "<span id=Close onclick='parent.opener=null;parent.close()' style=""+CSStext+"font-family:System;padding-right:2px;" title='Close'>x</span > "; temp += " < /td></tr > < tr > < td colspan = 2 > "; temp += " < div id = include style = 'overflow: scroll; overflow - x: hidden; overflow - y: auto; HEIGHT: 100 % ; width: " + CW_width + "' > "; temp += content; temp += " < /div>"; temp += "</td > < /tr></table > "; CW_Body.innerHTML = temp; } setTimeout("insert_content()", 1000); var if_max = true; function show_CW() { window.moveTo(10000, 10000); if (if_max) { New_CW.show(CW_top, CW_left, CW_width, CW_height); if (typeof(New_CW.document.all.include) != "undefined") { New_CW.document.all.include.style.width = CW_width; New_CW.document.all.Max.innerText = "1″; } } else { New_CW.show(0, 0, screen.width, screen.height); New_CW.document.all.include.style.width = screen.width; } } window.onfocus = show_CW; window.onresize = show_CW; // Move Window var drag_x, drag_y, draging = false function drag_move(e) { if (draging) { New_CW.show(e.screenX - drag_x, e.screenY - drag_y, CW_width, CW_height); return false; } } function drag_down(e) { if (e.button == 2) return; if (New_CW.document.body.offsetWidth == screen.width && New_CW.document.body.offsetHeight == screen.height) return; drag_x = e.clientX; drag_y = e.clientY; draging = true; e.srcElement.setCapture(); } function drag_up(e) { draging = false; e.srcElement.releaseCapture(); if (New_CW.document.body.offsetWidth == screen.width && New_CW.document.body.offsetHeight == screen.height) return; CW_top = e.screenX - drag_x; CW_left = e.screenY - drag_y; } </script> </html> |
验证IP地址格式是否正确
[html] ?<script LANGUAGE=”JavaScript”> […]
TABLAE相关(客户端动态增加行列)
[html] <html> <script LANGUAGE=”JScript& […]
写注册表
[code] <script> var WshShell = WScript.CreateObje […]
Javascript写注册表
1 2 3 4 5 6 7 8 9 10 |
<script> var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.RegWrite ("HKCUSoftwareACMEFortuneTeller", 1, "REG_BINARY"); WshShell.RegWrite ("HKCUSoftwareACMEFortuneTellerMindReader", "Goocher!", "REG_SZ"); var bKey = WshShell.RegRead ("HKCUSoftwareACMEFortuneTeller"); WScript.Echo (WshShell.RegRead ("HKCUSoftwareACMEFortuneTellerMindReader")); WshShell.RegDelete ("HKCUSoftwareACMEFortuneTellerMindReader"); WshShell.RegDelete ("HKCUSoftwareACMEFortuneTeller"); WshShell.RegDelete ("HKCUSoftwareACME"); </script> |
画图
[html] <object id=S style=”LEFT: 0px; WIDTH: 3 […]
Javascript画图
1 2 3 4 5 6 7 |
<object id=S style="LEFT: 0px; WIDTH: 392px; TOP: 0px; HEIGHT: 240px" height=240 width=392 classid="clsid:369303C2-D7AC-11D0-89D5-00A0C90833E6"> </object> <script> S.DrawingSurface.ArcDegrees(0,0,0,30,50,60); S.DrawingSurface.ArcRadians(30,0,0,30,50,60); S.DrawingSurface.Line(10,10,100,100); </script> |
文件上传过程中判断文件类型
[html] <input type=file onchange=”alert(this.v […]