易截截图软件、单文件、免安装、纯绿色、仅160KB

JavaScript格式化字符串工具

Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf conventions. See below for more details. You must specify the string and how to format the variables in it. Possible format values:
%% – Returns a percent sign
%b – Binary number
%c – The character according to the ASCII value
%d – Signed decimal number
%f – Floating-point number
%o – Octal number
%s – String
%x – Hexadecimal number (lowercase letters)
%X – Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f):
+ (Forces both + and – in front of numbers. By default, only negative numbers are marked)
– (Left-justifies the variable value)
0 zero will be used for padding the results to the right string size
[0-9] (Specifies the minimum width held of to the variable value)
.[0-9] (Specifies the number of decimal digits or maximum string length)
If you plan using UTF-8 encoding in your project don’t forget to set the page encoding to UTF-8 (Content-Type meta tag), and use Javascript UTF-8 utility found on this website.
原文链接: http://www.webtoolkit.info/javascript-sprintf.html
下载:
webtoolkit.sprintf.js
http://download.csdn.net/source/1972105 


相关文档:

JavaScript 获取对象的高度和宽度详细说明

scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......

select元素javascript常用操作

 *说明:select元素javascript常用操作
* 1.判断是否存在指定value的Item
* 2.加入一个Item
* 3.删除值为value的所有Item
* 4.删除某一个index的选项
* 5.更新第index项的value和text
* 6.设置select中指定text的第一个Item为选中
* 7.设置select中指定value的第一个Item为选中
* 8.得到当前选中项的v ......

javascript之表单验证 完美提升用户体验

引言
增加客户端的表单验证可以为用户提供更快的体验,但决不能忽视的是,客户端表单验证永远不应该取代服务器端的验证,而只能是辅助和增强。根据经验JavaScript验证表单基本分为以下几方面的内容,必填字段、特殊模式匹配等,还要注意错误的提示方式对一个表单的可用性有着极其重要的影响。
2建立表单
  &nb ......

JavaScript常用代码

1:js 字符串长度限制、判断字符长度、js限制输入、限制不能输入、textarea 长度限制
2.:js判断汉字、判断是否汉字 、只能输入汉字
3:js判断是否输入英文、只能输入英文
4:js只能输入数字,判断数字、验证数字、检测数字、判断是否为数字、只能输入数字
5:只能输入英文字符和数字
6: js email验证 、js 判断email 、信箱 ......

Flex与JavaScript的交互

Flex 与 JavaScript 交互,主要依靠Flex的ExternalInterface,其提供了addCallBack和call方法.
下面的例子将演示Flex调用javascript,和javascript调用Flex。
js 代码
-------------------------------------------------------------------------------------------------------------
function hello(param) {
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号