common.js

来自「又一个课程设计 简易 JSP 论坛 功能较简单的那种, 界面上模仿了 Disc」· JavaScript 代码 · 共 17 行

JS
17
字号
var $ = function(o) { return document.getElementById(o); };
var w = function(s) { document.write(s); };

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
String.prototype.isEmail = function() { return (/^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)$/.test(this)); };
String.prototype.left = function(n) { return this.slice(0, n); };
String.prototype.isPath = function() { return /^[a-z]\:[^\<\>\|\:\.\?\*\"]*/i.test(this); };

var page = {};
page._onloads_ = [];
page.onload = function(f) { this._onloads_.push(f); };
window.onload = function(e) { for (var i=0; i<page._onloads_.length; i=i+1) page._onloads_[i](e); };

var refreshVCode = function(img) { img.src = "servlet/VCode?" + Math.random(); };
var showVCode = function() { w("<img title='看不清?点击换一张' onclick=\"JavaScript:refreshVCode(this);\" onerror=\"JavaScript:refreshVCode(this);\" src=\"about:blank\" border='0' width='40' height='18' />"); };

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?