ajax基础知识:js事件触发大全

onactivate 当对象设置为活动元素时触发。
onbeforeactivate 对象要被设置为当前元素前立即触发。
onbeforecut 当选中区从文档中删除之前在源对象触发。
onbeforedeactivate 在 activeElement 从当前对象变为父文档其它对象之前立即触发。
onbeforeeditfocus 在包含于可编辑元素内的对象进入用户界面激活状态前或可编辑容器变成控件选中区前触发。
onbeforepaste 在选中区从系统剪贴板粘贴到文档前在目标对象上触发。
onclick 在用户用鼠标左键单击对象时触发。
oncontextmenu 在用户使用鼠标右键单击客户区打开上下文菜单时触发。
oncontrolselect 当用户将要对该对象制作一个控件选中区时触发。
oncut 当对象或选中区从文档中删除并添加到系统剪贴板上时在源元素上触发。
ondblclick 当用户双击对象时触发。
ondeactivate 当 activeElement 从当前对象变为父文档其它对象时触发。
ondrag 当进行拖曳操作时在源对象上持续触发。
ondragend 当用户在拖曳操作结束后释放鼠标时在源对象上触发。
ondragenter 当用户拖曳对象到一个合法拖曳目标时在目标元素上触发。
ondragleave 当用户在拖曳操作过程中将鼠标移出合法拖曳目标时在目标对象上触发。
ondragover 当用户拖曳对象划过合法拖曳目标时持续在目标元素上触发。
ondragstart 当用户开始拖曳文本选中区或选中对象时在源对象上触发。
ondrop 当鼠标按钮在拖曳操作过程中释放时在目标对象上触发。
onfocusin 当元素将要被设置为焦点之前触发。
onfocusout 在移动焦点到其它元素之后立即触发于当前拥有焦点的元素上触发。
onhelp 当用户在浏览器为当前窗口时按 F1 键时触发。
onkeydown 当用户按下键盘按键时触发。
onkeypress 当用户按下字面键时触发。
onkeyup 当用户释放键盘按键时触发。
onmousedown 当用户用任何鼠标按钮单击对象时触发。
onmousemove 当用户将鼠标划过对象时触发。
onmouseout 当用户将鼠标指针移出对象边界时触发。
onmouseover 当用户将鼠标指针移动到对象内时触发。
onmouseup 当用户在鼠标位于对象之上时释放鼠标按钮时触发。
onmousewheel 当鼠标滚轮按钮旋转时触发。
onmove 当对象移动时触发。
onmoveend 当对象停止移动时触发。
onmovestart 当对象开始移动时触发。
onpaste 当用户粘贴数据以便从系统剪贴板向文档传送数据时在目标对象上触发。
onpropertychange 当在对象上发生对象上发生属性更改时触发。
onreadystatechange 当对象状态变更时触发。
onresizeend 当用户更改完控件选中区中对象的尺寸时触发。
onresizestart 当用户开始更改控件选中区中对象的尺寸时触发。
onselectionchange 当文档的选中状态改变时触发。
onstop 当用户单击停止按钮或离开 页面时触发。

标签Tags:, , , , , , , , , , , , , , ,

图片轮换类,IE7、OP、FF、Chrome测试通过

<>
<head><>新闻图片轮换类</>
<script type=”text/javascript”>
var fs = new FadeSlideClass();
fs.Width = 430;
fs.Height = 250;
fs.AddImage(“http://www.5bay.cn/Test/Image/001.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/002.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/003.jpg“, “//g.cn”, “去Google”);
fs.AddImage(“http://www.5bay.cn/Test/Image/004.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/005.jpg“, “#”, “新闻标题”);
fs.RenderTo(“divStage”);

/* 以下代码构造轮换类 */
function FadeSlideClass()
{
this.Width = 450;
this.Height = 300;
this.BorderColor = “#ddd”;
this.CurrentColor = “green”;
this.Delay = 5000;
var divContainer = document.createElement(“”);
var divImage = document.createElement(“div”);
var ulList = document.createElement(“ul”);
var me = this;
var arrImg = new Array;
this.Tag = divContainer;
this.AddImage = function(strImageUrl, strLink, strTitle)
{
   arrImg.push(arguments);
}
this.RenderTo = function(container)
{
   if(typeof container == “string”) container = document.getElementById(container) || container;
   if(typeof container == “string”) return setTimeout(function(){ me.RenderTo(container); }, 100);
   if(!arrImg.length) throw new Error(“尚未添加图片。”);
   var cssFloat = typeof ulList.style.cssFloat == “string” ? “cssFloat” : “styleFloat”;
   divContainer.style.width = this.Width + “px”;
   divContainer.style.height = this.Height + “px”;
   divImage.style.width = Math.round(this.Width * (arrImg.length – 1) / arrImg.length) + “px”;
   divImage.style.height = this.Height + “px”;
   divImage.style[cssFloat] = “left”;
   ulList.style.width = (this.Width – parseInt(divImage.style.width)) + “px”;
   ulList.style.height = this.Height + “px”;
   ulList.style.margin = “0px”;
   ulList.style.padding = “0px”;
   ulList.style[cssFloat] = “left”;
   divContainer.style.overflow = “hidden”;
   divImage.style.overflow = “hidden”;
   ulList.onmouseover = function(){ clearTimeout(me.Handler) };
   ulList.onmouseout = function(){ AutoPlay(); };
   InitImage(2);
   InitList(arrImg.length);
   container.appendChild(divContainer);
   divContainer.appendChild(divImage);
   divContainer.appendChild(ulList);
   LiMouseOver.call(ulList.firstChild);
   AutoPlay();
   this.AddImage = function(){ throw new Error(“该方法已过时。”); }
}
this.Display = function(imgThumb)
{
   var img = divImage.lastChild.lastChild;
   var opa = new OpacityClass(img);
   opa.Set(20);
   img.src = imgThumb.src;
   img.parentNode.href = imgThumb.parentNode.href;
   img.parentNode.title = imgThumb.parentNode.title;
   clearInterval(ulList.Handler);
   ulList.Handler = setInterval(function(){
    if(opa.Add(5) >= 100)
    {
     divImage.firstChild.lastChild.src = img.src;
     clearInterval(ulList.Handler);
    }
   }, 25);
}
function LiMouseOver()
{
   if(this == ulList.oldLi) return;
   if(ulList.oldLi) ulList.oldLi.style.borderColor = me.BorderColor;
   this.style.borderColor = me.CurrentColor;
   ulList.oldLi = this;
   me.Display(this.firstChild.firstChild);
}
function InitImage(count)
{
   if(–count) arguments.callee(count);
   var a = document.createElement(“a”);
   a.target = “_blank”;
   divImage.appendChild(a).style.position = “absolute”;
   var img = new Image;
   img.width = parseInt(divImage.style.width);
   img.height = me.Height;
   img.border = 0;
   if(!a.appendChild(img).filters) img.style.opacity = 1;
   else img.style.filter = “alpha(opacity=100)”;
}
function InitList(count)
{
   if(–count) InitList(count);
   var isIeNoDtd = document.compatMode != “1Compat” && /msie/i.test(navigator.userAgent);
   var data = arrImg[count];
   var thumbWidth = parseInt(ulList.style.width);
   var thumbHeight = Math.round(me.Height / arrImg.length);
   var li = document.createElement(“li”);
   li.style.overflow = “hidden”;
   li.style.width = (isIeNoDtd ? thumbWidth : thumbWidth – 4) + “px”;
   li.style.height = (isIeNoDtd ? thumbHeight : thumbHeight – 4) + “px”;
   li.style.borderWidth = “2px”;
   li.style.borderStyle = “solid”;
   li.style.borderColor = me.BorderColor;
   var a = document.createElement(“a”);
   a.target = “_target”;
   a.href = data[1];
   a.title = data[2];
   var img = new Image;
   img.border = 0;
   img.width = thumbWidth;
   img.height = thumbHeight;
   img.src = data[0];
   img.style.verticalAlign = “top”;
   img.style.margin = “-2px”;
   a.appendChild(img);
   li.appendChild(a);
   li.style.listStyle = “none”;
   li.onmouseover = LiMouseOver;
   ulList.appendChild(li);
}
function AutoPlay()
{
   me.Handler = setTimeout(function()
   {
    LiMouseOver.call(ulList.oldLi.nextSibling || ulList.firstChild);
    AutoPlay();
   }, me.Delay);
}
function OpacityClass(tag)
{
   var isFilter = !!tag.filters;
   var obj = isFilter ? tag.filters.alpha : tag.style;
   this.Set = function(value)
   {
    obj.opacity = isFilter ? value : value / 100;
    return this;
   }
   this.Add = function(value)
   {
    var opa = isFilter ? obj.opacity : obj.opacity * 100;
    opa += value;
    if(opa > 100) opa = 100;
    obj.opacity = isFilter ? opa : opa / 100;
    return this;
   }
   this.valueOf = function()
   {
    return isFilter ? obj.opacity : obj.opacity * 100;
   }
}
}
</script>
</head>
<body>
<div id=”divStage”></div>
</body>
</html>

标签Tags:, , , , , , , , , , , , , , , ,

JS实现全景图效果360度旋转

< style="border-bottom: red 1px solid; position: absolute; border-left: red 1px solid; width: 500px; height: 190px; overflow: hidden; border-top: red 1px solid; cursor: hand; border-right: red 1px solid" id="1" onmouseout="change(1);" onmousemove="getpos()" onmouseover="clearTimeout(scrl);"><img onload="change(1);" alt="" src="http://www.jb51.net/upload/out500b.jpg" /></div>
<script>
var scrl,direction="right";
var x,xold,xdiff, i=1;

function change(start){
if(direction == "right"){
    if(div1.scrollTop+190 < div1.scrollHeight){
        div1.scrollTop += 190;
    }
    else{
        div1.scrollTop = 0;
    }
}
else{
    if(div1.scrollTop-190 > 0){
        div1.scrollTop -= 190;
    }
    else{
        div1.scrollTop = div1.scrollHeight;
    }
}
if(start) scrl = setTimeout("change(1)",100);
else clearTimeout(scrl);
}

function getpos(){
x = event.clientX;
xdiff = x – xold;
xold = x;
if(xdiff>0) direction = "right";
if(xdiff<0) direction = "left";
change(0);
}
</script>

标签Tags:, , , , ,

nginx的rewrite规则

正则表达式匹配,其中:

* ~ 为区分大小写匹配
* ~* 为不区分大小写匹配
* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配
文件及目录匹配,其中:

* -f和!-f用来判断是否存在文件
* -d和!-d用来判断是否存在目录
* -e和!-e用来判断是否存在文件或目录
* -x和!-x用来判断文件是否可执行
flag标记有:

* last 相当于Apache里的[L]标记,表示完成rewrite
* break 终止匹配, 不再匹配后面的规则
* redirect 返回302临时重定向 地址栏会显示跳转后的地址
* permanent 返回301永久重定向 地址栏会显示跳转后的地址
一些可用的全局变量有,可以用做条件判断(待补全) (更多…)

标签Tags:, , , , , , , , , , , , , , , , , , , , , , , , , , ,

URLSEO patchs for PHPOK3.0 simple

作者: 江小邪      [主页]
演示: 点击查看
适用版本: 3.0 Simple
添加日期: 2008-11-16 20:01
说明:

phpok基于php自身的伪静态补丁。提供形如下面演示地址的形式的链接。有bugs请跟评论,谢谢~

1、请先删除 data/lock. 文件
2、上传 压缩包内文件覆盖 phpok目录下的文件
3、运行 http://yoursite/setup.php 进行参数设置。注意务必正确设置phpok安装目录,最后以”/”结束
4、完成后请删除 setup.php
5、程序在phpok 3.0 Simple 下测试成功。
注意:打此补丁前请注意备份,否则所造成后果概不负责。

演示地址:http://phpok3.5bay.cn/html.php/home.html

下载地址:http://mydoc.5bay.cn/phpok3/UrlSeo_patchs_for_phpok3.0S.rar

标签Tags:, , , , , , , , , , , , , ,

URLSEO patchs for PHPOK 2.2

作者: 江小邪      [主页]
演示: 点击查看
适用版本: 2.2
添加日期: 2008-10-14 07:40

1、请先删除 data/lock. 文件
2、上传 压缩包内文件覆盖 phpok目录下的文件
3、运行 http://yoursite/setup.php 进行参数设置。注意务必正确设置phpok安装目录,最后以”/”结束
4、完成后请删除 setup.php
5、程序在phpok 2.2 下测试成功。
注意:打此补丁前请注意备份,否则所造成后果概不负责。

下载地址:http://www.5bay.cn/mydoc/phpok/UrlSeo_for_phpok22.rar

标签Tags:, , ,

标题title在seo中越来越重要

Title是整个html在搜索引擎搜索结果中返回的第一要素,在目前为止,它被证明是seo效果中最为重要的一项之一,里面拥有最为核心的关键字词,下面是点石互动小鹏搜集到一些目前最为有效,被认为是最佳做法的条列:

根据W3C的提议:title的字符不应该超过64个字符,绝对避免超过80个字符,一是有被封杀的危险,第二se有可能抛弃。(字符数是按照英文字符)

所有的title标签都打上自己网站的名字,换句话说是所有权。但有特例,如果这个页面是一个问题为title,或者说是一个帮助页面,就没必要。

每一页都要有不同的title,这样被索引的几率会增大,当然越独特的标题吸引浏览者更为有效果。如果你是copy的帮助或者其他文章,没有既定的title,那么就干脆将你的关键字做成你的title吧。 (更多…)

标签Tags:, , ,

26步打造高访问量网站

  正如我们已经知道的,为网站带来高访问量并不象表面上看那么简单,除了需投入脑力分析与探索外,其还是一项相当繁琐的工作。在1999年9月,Brett Tabke在Webmaster World论坛上发布了其“26 Steps to 15k a Day”(注:Webmaster World论坛在2002年曾经过改版,故目前该文的发布日期为2002年2月),这篇被许多Webmaster视作经典的文章的网上广泛流传。随时间的演变,其中的有些内容依然有效,如保持内容的不间断更新,而另一部分内容则渐渐显示出过时的迹象,如向搜索引擎注册。Shawn Campbell,一位SEO专家,撰写了一篇新的26步打造高访问量网站的文章。 (更多…)

标签Tags:, , , ,

搜索引擎优化(SEO)

确定好网站的关键词和关键字密度
(1)如何确定网站的关键词
网站关键词的选择很大程度上取决于企业建设网站的思路。核心关键词不要太多,一般限定在七个以内。在关键词的选择上,可分三个方面进行:首先是企业简称,其次是产品统称,最后是行业简称。如:无风的港湾(http://www.5bay.cn),它的网站核心关键词应该是:无风港湾、无风、港湾、5bay、5bay.cn。
(2)如何确定网站的关键字密度
关键字密度 (Keyword Density) 是指在一个页面中,关键字(keyword)或关键字段(keyphrase)占所有该页面中总的文字的比例,该指标对 搜索引擎的优化起到关键的作用。为自然提高在搜索引擎中的 排名位置,您网站中页面的关键字密度不能过高,也不要过低,一般在 2% 到 8% 较为合适。如果要达到 2% 的比例,那么您在平均100 个文字中最好包含 2 个关键字或关键字段,如果在 1000 个文字中仅仅只包含1-2 个关键字或关键字段,那么关键字密度就被稀释了。记住,您千万别把所有的关键字或关键字段堆积在一起,要不搜索引擎将人为是一种恶意行为(Spam),直接降低您网站的排名位置。

标签Tags:, , ,