博文
prototype window 扩展(2010-09-28 12:54:00)
摘要:今天研究prototype winodw源码,看到源码中有一个全局变量 Windows,这个可以对每个window进行管理,也可以对所有window进行管理。
其中有两个方法close,closeAll,就想到再加两个show,showAll,代码如下:
show: function(id, event) {
var win = this.getWindow(id);
if (win)
win.show();
if (event)
Event.start(event);
},
showAll: function(){
this.windows.each( function(w) {Windows.show(w.getId())} );
},
试了一下,可以正常工作。
......
Google 地图使用(2010-07-30 18:00:00)
摘要:1、先在谷歌地图上,注册一个网址的API接口KEY
2、我注册的是localhost本机地址,生成的key如下:
ABQIAAAANpgrTJS0VJo_3Mnd4asV0BT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ1qjKcPCry58uG062w8uCxECGTzg 3、新建一个普通的HTML文件,内容如下,记得KEY要换成你自己的,就可以了,下面就会显示成都的地图。很方便的
成都, 东经104.06, 北纬30.67 <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true_or_false&key=ABQIAAAANpgrTJS0VJo_3Mnd4asV0BT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ1qjKcPCry58uG062w8uCxECGTzg" type="text/javascript"></script>
<script type="text/javascript">
//成都, 东经104.06, 北纬30.67
function initialize() {
&n......
Google AJAX 搜索 API(2010-07-28 18:42:00)
摘要:
什么是 Google AJAX 搜索 API?
Google AJAX 搜索 API 可让您通过 JavaScript 将 Google 搜索放在网页中。您可以嵌入一个简易的动态搜索框,并可以在自己的网页上显示搜索结果,或者以创新的编程方式使用这些结果。请查看以下示例获得一些启发。
这是谷歌搜索API的注册页面
http://code.google.com/intl/zh-CN/apis/ajaxsearch/signup.html
我亲自试过了,可以的.
注意,在它自动生成的给我的示例代码中,需要自己手动换行,不然打开网站会一直是Loading...
大家可以看我注册之后,放到网站上的效果
网址如下:
http://lixuwei.freehostia.com/
......
基于prototype的轻量级右键菜单(2010-07-13 19:04:00)
摘要:示例:
http://yura.thinkweb2.com/scripting/contextMenu/
How to use it
Download proto.menu.0.6.js and include it in your page
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/proto.menu.0.6.js"></script> There's an optional CSS file if you do not wish to style menu yourself <link rel="stylesheet" href="proto.menu.0.6.css" type="text/css" media="screen" /> Create an array of links to display in a menu
var myMenuItems = [
{
name: 'Edit',
className: 'edit',
callback: function() {
alert('Forward function called');
}
},{
name: 'Copy',
className: 'copy',
callback: function() {
alert('Copy function called');
}
},{
name: 'Delete',
disabled: true,
className: 'delete'
},{
separator: true
},{
name: 'Save',
className: 'save',
callback: function() {
alert('Saving...');
}
}
] Initialize Proto.......
网页中添加QQ状态(2010-07-07 21:11:00)
摘要:去网站 http://wp.qq.com/index.html 中填上自己的QQ,就可以实现了
<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=4c824e1bb83417d921d8e112d933997cc6702f5e99c6fc2393a349a2b394fb7b"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=4c824e1bb83417d921d8e112d933997cc6702f5e99c6fc2393a349a2b394fb7b';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC='http://wpa.qq.com/pa?p=1:546525688:41' alt=""></a>......
