wtpcmd.js
来自「C#编写的在线用户统计、在线编辑器、验证码图片」· JavaScript 代码 · 共 836 行 · 第 1/2 页
JS
836 行
/*
* WtpCmd.js @Microsoft Visual Studio 2008 <.NET Framework 2.0 (or Higher)>
* AfritXia
* 2008/3/16
*
* Copyright(c) http://www.AfritXia.NET/
*
*/
///////////////////////////////////////////////////////////////////
//
// CWtpSetFontNameCmd 命令类
//
// Parameters:
// selectID, 下拉框标记 ID
// tagDesignerPane, 设计器窗体
//
function CWtpSetFontNameCmd(selectID, tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 获取 <select> 标记
var selectTag = document.getElementById(selectID);
if (selectTag == null)
return;
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("FontName", false, selectTag.value);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpSetFontSizeCmd 命令类
//
// Parameters:
// selectID, 下拉框标记 ID
// tagDesignerPane, 设计器窗体
//
function CWtpSetFontSizeCmd(selectID, tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 获取 <select> 标记
var selectTag = document.getElementById(selectID);
if (selectTag == null)
return;
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("FontSize", false, selectTag.value);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpSetForeColorCmd 命令类
//
// Parameters:
// selectID, 下拉框标记 ID
// tagDesignerPane, 设计器窗体
//
function CWtpSetForeColorCmd(selectID, tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 获取 <select> 标记
var selectTag = document.getElementById(selectID);
if (selectTag == null)
return;
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("ForeColor", false, selectTag.value);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpSetBackColorCmd 命令类
//
// Parameters:
// selectID, 下拉框标记 ID
// tagDesignerPane, 设计器窗体
//
function CWtpSetBackColorCmd(selectID, tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 获取 <select> 标记
var selectTag = document.getElementById(selectID);
if (selectTag == null)
return;
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("BackColor", false, selectTag.value);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpBoldCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpBoldCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("Bold");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpItalicCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpItalicCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("Italic");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpUnderLineCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpUnderLineCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("UnderLine");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpStrikeThroughCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpStrikeThroughCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("StrikeThrough");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpSuperScriptCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpSuperScriptCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 事先清除格式
(new CWtpRemoveFormatCmd(tagDesignerPane)).execute();
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("SuperScript");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpSubScriptCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpSubScriptCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
// 事先清除格式
(new CWtpRemoveFormatCmd(tagDesignerPane)).execute();
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("SubScript");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpBulletedListCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpBulletedListCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("InsertUnorderedList", false);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpNumberedListCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpNumberedListCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("InsertOrderedList", false);
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpIndentCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpIndentCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("Indent");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpOutdentCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpOutdentCmd(tagDesignerPane) {
if (tagDesignerPane == null)
throw new Error("tagDesignerPane is Null");
// 保存命令目标
this.m_targetDesignerPane = tagDesignerPane;
// 执行命令
this.execute = null;
with (this) {
// 执行命令
execute = function() {
m_targetDesignerPane.m_spanElement.focus();
m_targetDesignerPane.m_spanElement.document.execCommand("Outdent");
}
}
}
///////////////////////////////////////////////////////////////////
//
// CWtpJustifyLeftCmd 命令类
//
// Parameters:
// tagDesignerPane, 设计器窗体
//
function CWtpJustifyLeftCmd(tagDesignerPane) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?