易截截图软件、单文件、免安装、纯绿色、仅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 ......

设为首页和添加收藏的Javascript代码

设为首页和添加收藏的Javascript代码,兼容性还可以,各种主流浏览器都测试通过了。
function addfavorite(){//加入收藏
if (document.all){
window.external.addFavorite("http://"+document.location.host+"/",document.title);
}else if (window.sidebar){
window.sidebar.addPanel(document.tit ......

用 JavaScript 实现网页图片等比例缩放

 <script language="JavaScript" type="text/javascript">
    <!--
    // 说明:用 JavaScript 实现网页图片等比例缩放
    // 整理:http://www.CodeBit.cn 
    function DrawImage(ImgD,FitWidth,FitHei ......

配合javascript动态操作表头

这段时间在用displayTag, 它有很多好用的功能,俺也不就在这赘述,当然也有几个不方便的地方. 比如求和后"%"的显示等与求和相关的缺点, 这里先介绍一个缺点并把我从网上整理出来的解决方案也一并帖出. 问题是这样的: 由于业务要求, 当用户鼠标位于表中某一列的标头时, 在这个表头"动画"地显示这列的简介. 先看下做出来的效果: ......

Javascript中最常用的55个经典技巧.txt

1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号