Javascript代码实现图片玻璃特效
文件内容如下:(两个文件glossy.js和glossy.html)
/********************************** glossy.js ***********************************/
/**
* glossy.js 1.31 (19-Jul-2007)
* (c) by Christian Effenberger
* All Rights Reserved
* Source: glossy.netzgesta.de
* Distributed under NSL
* License permits free of charge
* use on non-commercial and
* private web sites only
**/
var tmp = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
if(tmp) var isIE = document.namespaces ? 1 : 0;
if(isIE) {
if(document.namespaces['v'] == null) {
var stl = document.createStyleSheet();
stl.addRule("v\\:*", "behavior: url(#default#VML);");
document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
}
}
function getImages(className){
var children = document.getElementsByTagName('img');
var elements = new Array(); var i = 0;
var child; var classNames; var j = 0;
for (i=0;i<children.length;i++) {
child = children;
classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++) {
if (classNames[j] == className) {
elements.push(child);
break;
}
}
}
return elements;
}
function getClasses(classes,string){
var temp = '';
for (var j=0;j<classes.length;j++) {
if (classes[j] != string) {
if (temp) {
temp += ' '
}
temp += classes[j];
}
}
return temp;
}
function getClassValue(classes,string){
var temp = 0; var pos = string.length;
for (var j=0;j<classes.length;j++) {
if (classes[j].indexOf(string) == 0) {
temp = Math.min(classes[j].substring(pos),100);
break;
}
}
return Math.max(0,temp);
}
function getClassColor(classes,string){
var temp = 0; var str = ''; var pos = string.length;
for (var j=0;j<classes.length;j++) {
if (classes[j].indexOf(string) == 0) {
temp = classes[j].substring(pos);
str =
相关文档:
创建一个日期对象:
var objDate=new Date([arguments list]);
参数形式有以下5种:
new Date("month dd,yyyy hh:mm:ss");
new Date("month dd,yyyy");
new Date(yyyy,mth,dd,hh,mm,ss);
new Date(yyyy,mth,dd);
new Date(ms); ......
匹配中文字符的正则表达式: [u4e00-u9fa5]
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了
匹配双字节字符(包括汉字在内):[^x00-xff]
评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)
匹配空白行的正则表达式:ns*r
评注:可以用来删除空白行
匹配HTML标记的正则表达式:< (S ......
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7& ......
语法
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] )
sURL 可选. URL 字符串 . 如果URL为空, 将以about:blank打开.
sName 可选. 字符串 描述打开窗口的名字(name). 可以做为form 和 a 标签的TARGET属性值 .
sFeatures 可选. 字符串 格式如"fullscreen=yes,toolbar=yes".channelmode = { yes | no | ......
定义与用法
The prototype property allows you to add properties and methods to an
object.
prototype属性允许你向一个对象添加属性和方法
Syntax
语法
object.prototype.name=value
Example 1
实例
In this example we will show how to use the prototype property to add a
property to an object:
在下 ......