字符串截取(包括html,BasicPage.cs类使用)
/// <summary>
/// 截断字符串(中文计一个字符宽度,其它计半个字符宽度)
/// </summary>
/// <param name="input">需截断的字符串</param>
/// <param name="length">字符宽度</param>
/// <returns>截断字符串(带"...")</returns>
protected string truncatedChars(string input, int length)
{
input = Server.HtmlEncode(input);
if (input.Length > length)
{
int pos = 0;
string result = "";
foreach (char chr in input)
{
if (Regex.IsMatch(chr.ToString(), "[^\x00-\xff]"))
{
pos += 2;
}
else
{
pos += 1;
}
result += chr.To
相关文档:
using System.Text.RegularExpressions; //引入的命名空间
以下为引用的内容:
//清除HTML函数
public static string NoHTML(string Htmlstring)
{
//删除脚本
Htmlstr ......
一、基础理解:
var e = document.getElementById("selectId");
e. options= new Option("文本","值") ;
//创建一个option对象,即在<select>标签中创建一个或多个<option value="值">文本</option>
//options是个数组,里面可以存放多个<option value="值">文本</option>这样的标签
1:opt ......
/// <summary>
/// 去掉所有HTML标签
/// </summary>
/// <param name="strHtml">源字符串</param> ......
在FckEditor.Net 2.64和asp.net 2.0的环境下发现如下问题:如果浏览器执行返回动作,FckEditor编辑框内显示html代码:
解决方法是:修改文件FCKEditor\editor\fckeditor.html,在window.onload = function()的函数第一行添加
FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value);
如果问题不 ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>文本编辑器</title>
<meta http-equiv="C ......