jQuery提供了两个API可以直接用来为元素添加内容。
html()text()
其中html()是为指定的元素添加html内容
text()是为指定的元素添加文本内容
两者的区别在于,text中的内容是纯文本,不会被解析为html
如果要对如下html代码进行操作
使用html()
$('p').html('Hello World, I am a...
分类:
Web程序 时间:
2014-05-23 02:36:25
阅读次数:
381
/** JQuery Html Encoding、Decoding
* 原理是利用JQuery自带的html()和text()函数可以转义Html字符
* 虚拟一个Div通过赋值和取值来得到想要的Html编码或者解码
*/
//Html编码获取Html转义实体
function htmlEncode(value){
return $('').text(value).html();
}
//...
分类:
Web程序 时间:
2014-05-23 01:23:28
阅读次数:
499
介绍一个list滑动时通过一个text提示Array首字母位置的应用
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file exce...
分类:
其他好文 时间:
2014-05-23 00:58:42
阅读次数:
326
using System;using System.Collections.Generic;using
System.Linq;using System.Text;/* * 单例模式 * 保证对象的唯一性 */namespace SingleDemo{ class
Program { ...
分类:
其他好文 时间:
2014-05-22 16:10:25
阅读次数:
222
using System;using System.Collections.Generic;using
System.Linq;using System.Text;using System.Threading.Tasks;namespace outAndref{
class Program ...
分类:
其他好文 时间:
2014-05-22 16:04:40
阅读次数:
258
using System;using System.Collections.Generic;using
System.ComponentModel;using System.Data;using System.Drawing;using
System.Linq;using System.Text;u...
分类:
其他好文 时间:
2014-05-22 16:00:38
阅读次数:
196
using System;using System.Collections.Generic;using
System.Linq;using System.Text;using System.Threading.Tasks;namespace 内置委托{
static class Program .....
分类:
其他好文 时间:
2014-05-22 15:58:08
阅读次数:
159
using System;using System.Collections.Generic;using
System.Linq;using System.Text;using System.Threading.Tasks;namespace 二维数组{ class
Program { ...
分类:
其他好文 时间:
2014-05-22 15:54:53
阅读次数:
227
using System;using System.Collections.Generic;using
System.IO;using System.Linq;using System.Text;using
System.Threading.Tasks;namespace 序列化反序列化{ c...
分类:
其他好文 时间:
2014-05-22 15:52:52
阅读次数:
264
前些时间有这么个需求,需要实现选中div里面的文字,选中了的文字可直接按ctrl+v(或者右键)实现黏贴操作。html代码:大家好!调用以下javascript方法,实现选择上面div中的内容:1
selectText(“text”)javascript代码: 1 function selectTe...
分类:
编程语言 时间:
2014-05-22 15:12:41
阅读次数:
237