Javascript
标签云介绍
Posted in Javascript on 2010/07/23 / 评论(0) »
一种是flash方式:

官网:http://www.roytanck.com/2008/05/19/how-to-repurpose-my-tag-cloud-flash-movie/
目前的官方版本对多字节,unicode的支持不行,比如中文无法显示。
不过效果是很好的,在wordpress是很出名的plugin。
google找了一个破解版本支持了中文,在附件会提供下载
下载文件
一种是javascript方式:

官网:http://jeroenvanwarmerdam.nl/content/resources/javascript/jscumulus/jscumulus.aspx
官方的版本效果差点,如example :http://jeroenvanwarmerdam.nl/content/resources/javascript/jscumulus/js-cumulus.html
我研究使用了一下,加了一下overflow;
下载文件
官网:http://www.roytanck.com/2008/05/19/how-to-repurpose-my-tag-cloud-flash-movie/
目前的官方版本对多字节,unicode的支持不行,比如中文无法显示。
不过效果是很好的,在wordpress是很出名的plugin。
google找了一个破解版本支持了中文,在附件会提供下载
下载文件 一种是javascript方式:
官网:http://jeroenvanwarmerdam.nl/content/resources/javascript/jscumulus/jscumulus.aspx
官方的版本效果差点,如example :http://jeroenvanwarmerdam.nl/content/resources/javascript/jscumulus/js-cumulus.html
我研究使用了一下,加了一下overflow;
下载文件 [转]关于javascript控制Windows Media Player
Posted in Javascript on 2008/01/29 / 评论(0) »
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="wmp" >
<param name="URL" value="" /> //媒体文件地址
<param name="rate" value="1" />
<param name="balance" value="0" /> //声道0全声道,-100左声道,100右声道
<param name="currentPosition" value="0" />
<param name="playCount" value="1" /> //播放次数
<param name="autoStart" value="-1" /> //是否自动播放-1是,0否
<param name="currentMarker" value="0" />
<param name="invokeURLs" value="-1" />
<param name="volume" value="50" /> //音量
<param name="mute" value="0" />'); //是否静音-1是,0否
<param name="uiMode" value="none" /> //播放器模式full(默认)显示全部控件,none仅视频窗口,mini视频及一些常用控件,invisiblei不显示任何控件及视频窗口
<param name="stretchToFit" value="0" />
<param name="windowlessVideo" value="0" />
<param name="enabled" value="-1" />');
<param name="enableContextMenu" value="-1" />
<param name="fullScreen" value="0" />'); //是否全屏
<param name="enableErrorDialogs" value="-1" />//是否允许出错信息提示
</object>
JavaScript操作函数(wmp为播放机ID,注意区分大小写)
wmp.URL="" //播放媒体地址
wmp.controls.play() //开始播放
wmp.controls.stop() //停止播放
wmp.controls.pause() //暂停播放
wmp.settings.mute=true | false //控制是否静音
wmp.fullScreen=true | false //控制是否全屏
获取播放机状态
wmp.playState //播放机状态,共有1-10个状态,具体如下
wmp.playState==1 //停止播放
wmp.playState==2 //暂停播放
wmp.playState==3 //正常播放
wmp.playState==4 //向前搜索
wmp.playState==5 //向后搜索
wmp.playState==6 //缓冲处理
wmp.playState==7 //等待反应
wmp.playState==8 //播放完毕
wmp.playState==9 //连接媒体
wmp.playState==10 //准备就绪
wmp.controls.currentPositionString //取得媒体当前位置,以形如 06:01 的时间形式显示
wmp.controls.currentPosition //取得媒体当前位置,以形如 300.001 的秒数形式显示,精确到毫秒
wmp.currentMedia.durationString //取得媒体总长度,以形如 06:01 的时间形式显示
wmp.currentMedia.duration //取得媒体总长度,以形如 300.001 的秒数形式显示,精确到毫秒
转自
http://www.cnblogs.com/tt03030576/archive/2007/07/16/819334.html
javascript 技巧集 (ZT)
Posted in Javascript on 2007/08/09 / 评论(0) »
事件源对象
event.srcElement.tagName
event.srcElement.type
捕获释放
event.srcElement.setCapture();
event.srcElement.releaseCapture();
事件按键
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
事件返回值
event.returnValue
鼠标位置
event.x
event.y
窗体活动元素
document.activeElement
绑定事件
document.captureEvents(Event.KEYDOWN);
访问窗体元素
document.all("txt").focus();
document.all("txt").select();
窗体命令
document.execCommand
窗体COOKIE
document.cookie
菜单事件
document.oncontextmenu
创建元素
document.createElement("SPAN");
根据鼠标获得元素:
document.elementFromPoint(event.x,event.y).tagName=="TD
document.elementFromPoint(event.x,event.y).appendChild(ms)
窗体图片
document.images[索引]
窗体事件绑定
document.onmousedown=scrollwindow;
元素
document.窗体.elements[索引]
对象绑定事件
document.all.xxx.detachEvent('onclick',a);
插件数目
navigator.plugins
取变量类型
typeof($js_libpath) == "undefined"
下拉框
下拉框.options[索引]
下拉框.options.length
查找对象
document.getElementsByName("r1");
document.getElementById(id);
定时
timer=setInterval('scrollwindow()',delay);
clearInterval(timer);
UNCODE编码
escape() ,unescape
父对象
obj.parentElement(dhtml)
obj.parentNode(dom)
交换表的行
TableID.moveRow(2,1)
替换CSS
document.all.csss.href = "a.css";
并排显示
display:inline
隐藏焦点
hidefocus=true
根据宽度换行
style="word-break:break-all"
自动刷新
<meta HTTP-EQUIV="refresh" CONTENT="8;URL=http://www.kakapo.cn">
简单邮件
快速转到位置
obj.scrollIntoView(true)
锚
anchors
网页传递参数
location.search();
可编辑
obj.contenteditable=true
执行菜单命令
obj.execCommand
双字节字符
/[^\x00-\xff]/
汉字
/[\u4e00-\u9fa5]/
让英文字符串超出表格宽度自动换行
word-wrap: break-word; word-break: break-all;
透明背景
<IFRAME src="1.htm" width=300 height=180 allowtransparency></iframe>
获得style内容
obj.style.cssText
HTML标签
document.documentElement.innerHTML
第一个style标签
document.styleSheets[0]
style标签里的第一个样式
document.styleSheets[0].rules[0]
防止点击空链接时,页面往往重置到页首端。
word
上一网页源
asp:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer
释放内存
CollectGarbage();
禁止右键
document.oncontextmenu = function() { return false;}
禁止保存
禁止选取
地址栏图标
favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下
收藏栏图标
查看源码
关闭输入法
自动全选
title换行
obj.title = "123 sdfs "
获得时间所代表的微秒
var n1 = new Date("2004-10-10".replace(/-/g, "\/")).getTime()
窗口是否关闭
win.closed
checkbox扁平
获取选中内容
document.selection.createRange().duplicate().text
窗口最大化
<body onload="window.resizeTo(window.screen.width - 4,window.screen.height-50);window.moveTo(-4,-4)">
无关闭按钮IE
window.open("aa.htm", "meizz", "fullscreen=7");
统一编码/解码
alert(decodeURIComponent(encodeURIComponent("http://你好.com?as= hehe")))
encodeURIComponent对":"、"/"、";" 和 "?"也编码
参考资料
http://www.cnblogs.com/seagate_cn/archive/2005/04/21/142825.html
event.srcElement.tagName
event.srcElement.type
捕获释放
event.srcElement.setCapture();
event.srcElement.releaseCapture();
事件按键
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
事件返回值
event.returnValue
鼠标位置
event.x
event.y
窗体活动元素
document.activeElement
绑定事件
document.captureEvents(Event.KEYDOWN);
访问窗体元素
document.all("txt").focus();
document.all("txt").select();
窗体命令
document.execCommand
窗体COOKIE
document.cookie
菜单事件
document.oncontextmenu
创建元素
document.createElement("SPAN");
根据鼠标获得元素:
document.elementFromPoint(event.x,event.y).tagName=="TD
document.elementFromPoint(event.x,event.y).appendChild(ms)
窗体图片
document.images[索引]
窗体事件绑定
document.onmousedown=scrollwindow;
元素
document.窗体.elements[索引]
对象绑定事件
document.all.xxx.detachEvent('onclick',a);
插件数目
navigator.plugins
取变量类型
typeof($js_libpath) == "undefined"
下拉框
下拉框.options[索引]
下拉框.options.length
查找对象
document.getElementsByName("r1");
document.getElementById(id);
定时
timer=setInterval('scrollwindow()',delay);
clearInterval(timer);
UNCODE编码
escape() ,unescape
父对象
obj.parentElement(dhtml)
obj.parentNode(dom)
交换表的行
TableID.moveRow(2,1)
替换CSS
document.all.csss.href = "a.css";
并排显示
display:inline
隐藏焦点
hidefocus=true
根据宽度换行
style="word-break:break-all"
自动刷新
<meta HTTP-EQUIV="refresh" CONTENT="8;URL=http://www.kakapo.cn">
简单邮件
快速转到位置
obj.scrollIntoView(true)
锚
anchors
网页传递参数
location.search();
可编辑
obj.contenteditable=true
执行菜单命令
obj.execCommand
双字节字符
/[^\x00-\xff]/
汉字
/[\u4e00-\u9fa5]/
让英文字符串超出表格宽度自动换行
word-wrap: break-word; word-break: break-all;
透明背景
<IFRAME src="1.htm" width=300 height=180 allowtransparency></iframe>
获得style内容
obj.style.cssText
HTML标签
document.documentElement.innerHTML
第一个style标签
document.styleSheets[0]
style标签里的第一个样式
document.styleSheets[0].rules[0]
防止点击空链接时,页面往往重置到页首端。
word
上一网页源
asp:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer
释放内存
CollectGarbage();
禁止右键
document.oncontextmenu = function() { return false;}
禁止保存
禁止选取
地址栏图标
favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下
收藏栏图标
查看源码
关闭输入法
自动全选
title换行
obj.title = "123 sdfs "
获得时间所代表的微秒
var n1 = new Date("2004-10-10".replace(/-/g, "\/")).getTime()
窗口是否关闭
win.closed
checkbox扁平
获取选中内容
document.selection.createRange().duplicate().text
窗口最大化
<body onload="window.resizeTo(window.screen.width - 4,window.screen.height-50);window.moveTo(-4,-4)">
无关闭按钮IE
window.open("aa.htm", "meizz", "fullscreen=7");
统一编码/解码
alert(decodeURIComponent(encodeURIComponent("http://你好.com?as= hehe")))
encodeURIComponent对":"、"/"、";" 和 "?"也编码
参考资料
http://www.cnblogs.com/seagate_cn/archive/2005/04/21/142825.html
如何将图片复制到剪贴版?
Posted in Javascript on 2007/03/21 / 评论(1) »
// 复制图片到剪贴版
function CopyImage(img)
{
if (img.tagName != 'IMG') return;
if (typeof img.contentEditable == 'undefined') return;
if (!document.body.createControlRange) return;
var ctrl = document.body.createControlRange();
img.contentEditable = true;
ctrl.addElement(img);
ctrl.execCommand('Copy');
img.contentEditable = false;
alert('复制完成,到QQ对话框里按Ctrl-V就可以啦!');
}
彩字绣网站:
http://www.czxiu.com/index.php?t=%E7%BB%8F%E5%85%B8
如何取得radio的值
Posted in Javascript on 2007/02/27 / 评论(0) »
function getRadioValue(radio){
var RadioValue='';
for(i=0,len=radio.length;i<len;i++){
if(radio[i].checked){
RadioValue = radio[i].value
}
}
return RadioValue;
}
用javascript动态创建并提交表单form,表格table
Posted in Javascript on 2006/10/23 / 评论(5) »
通过在html触发动作,提交一个表单。代码如下:
<script>
//helper function to create the form
function getNewSubmitForm(){
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}
//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue){
var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
inputForm.appendChild(newElement);
newElement.value = elementValue;
return newElement;
}
//function that creates the form, adds some elements
//and then submits it
function createFormAndSubmit(){
var submitForm = getNewSubmitForm();
createNewFormElement(submitForm, "field1", "somevalue");
createNewFormElement(submitForm, "field2", "somevalue");
submitForm.action= "someURL";
submitForm.submit();
}
</script>
<input type="button" value="Click to create form and submit" onclick="createFormAndSubmit()">
<script>
//helper function to create the form
function getNewSubmitForm(){
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}
//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue){
var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
inputForm.appendChild(newElement);
newElement.value = elementValue;
return newElement;
}
//function that creates the form, adds some elements
//and then submits it
function createFormAndSubmit(){
var submitForm = getNewSubmitForm();
createNewFormElement(submitForm, "field1", "somevalue");
createNewFormElement(submitForm, "field2", "somevalue");
submitForm.action= "someURL";
submitForm.submit();
}
</script>
<input type="button" value="Click to create form and submit" onclick="createFormAndSubmit()">
» 阅读全文



