HTML5的诞生为Web App以及移动App开发带来了许多新鲜有趣的JavaScript与HTML API。本文将介绍5个能够让你事半功倍的HTML5特性。
1. DNS Prefetching
DNS主机名解析有时会出现拖慢网站速度的问题。现代浏览器当遇到DNS解析时已经十分聪明——用户在跟随某个链接之前,浏览器先尝试解析域名再将其进行缓存。
DNS Prefetching特性允许开发者手动控制,告...
HTML5的诞生为Web App以及移动App开发带来了许多新鲜有趣的JavaScript与HTML API。本文将介绍5个能够让你事半功倍的HTML5特性。
1. DNS Prefetching
DNS主机名解析有时会出现拖慢网站速度的问题。现代浏览器当遇到DNS解析时已经十分聪明——用户在跟随某个链接之前,浏览器先尝试解析域名再将其进行缓存。
DNS Prefetching特性允许开发者手动控制,告...
实现起来非常简单,为input添加名为 x-webkit-speech 的属性就行了。
可以用Chrome浏览器点击话筒体验一下语音搜索。
试试语言搜索
相关属性设置:
设置语言种类...
本文给大家推荐的8个国外网站,让大家了解结合了Javascript和CSS的HTML5技术在网站和Web应用设计中的最新发展。其中,“Air Jordan 2012”为学习设计的朋友提供了很多灵感,而“Draw Stick Man”是交互设计的经典之作,最后的“Believe in”虽然不是什么特别绚丽的设计,但简单的设计,却有不简单的效果。
如果你一...
一、JW Player是什么?
简单地说,JW Player是一种基于flash的交互式网页媒体播放器。它是由Jeroen 和 Wijering共同建立的LongTail Video所开发,问世于2005年,当时仍名不经传的YouTube首次采用的播放器就是JW Player。官方网址:http://www.longtailvideo.com/。
JW Player含:FLV Player、WMV P...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>图片</title> <script language="javascript"> <!-- //图片滚动列表 mengjia 070927 var Speed_1 = 10; //速度(毫秒) var Space_1 = 20; //每次移动(px) var PageWidth_1 = 116 * 3; //翻页宽度 var interval_1 = 7000; //翻页间隔 var fill_1 = 0; //整体移位 var MoveLock_1 = false; var MoveTimeObj_1; var MoveWay_1="right"; var Comp_1 = 0; var AutoPlayObj_1=null; function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}} function AutoPlay_1(){clearInterval(AutoPlayObj_1);AutoPlayObj_1=setInterval('ISL_GoDown_1();ISL_StopDown_1();',interval_1)} function ISL_GoUp_1(){if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="left";MoveTimeObj_1=setInterval('ISL_ScrUp_1();',Speed_1);} function ISL_StopUp_1(){if(MoveWay_1 == "right"){return};clearInterval(MoveTimeObj_1);if((GetObj('ISL_Cont_1').scrollLeft-fill_1)%PageWidth_1!=0){Comp_1=fill_1-(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1);CompScr_1()}else{MoveLock_1=false} AutoPlay_1()} function ISL_ScrUp_1(){if(GetObj('ISL_Cont_1').scrollLeft<=0){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft+GetObj('List1_1').offsetWidth} GetObj('ISL_Cont_1').scrollLeft-=Space_1} function ISL_GoDown_1(){clearInterval(MoveTimeObj_1);if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="right";ISL_ScrDown_1();MoveTimeObj_1=setInterval('ISL_ScrDown_1()',Speed_1)} function ISL_StopDown_1(){if(MoveWay_1 == "left"){return};clearInterval(MoveTimeObj_1);if(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){Comp_1=PageWidth_1-GetObj('ISL_Cont_1').scrollLeft%PageWidth_1+fill_1;CompScr_1()}else{MoveLock_1=false} AutoPlay_1()} function ISL_ScrDown_1(){if(GetObj('ISL_Cont_1').scrollLeft>=GetObj('List1_1').scrollWidth){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft-GetObj('List1_1').scrollWidth} GetObj('ISL_Cont_1').scrollLeft+=Space_1} function CompScr_1(){if(Comp_1==0){MoveLock_1=false;return} var num,TempSpeed=Speed_1,TempSpace=Space_1;if(Math.abs(Comp_1)<PageWidth_1/2){TempSpace=Math.round(Math.abs(Comp_1/Space_1));if(TempSpace<1){TempSpace=1}} if(Comp_1<0){if(Comp_1<-TempSpace){Comp_1+=TempSpace;num=TempSpace}else{num=-Comp_1;Comp_1=0} GetObj('ISL_Cont_1').scrollLeft-=num;setTimeout('CompScr_1()',TempSpeed)}else{if(Comp_1>TempSpace){Comp_1-=TempSpace;num=TempSpace}else{num=Comp_1;Comp_1=0} GetObj('ISL_Cont_1').scrollLeft+=num;setTimeout('CompScr_1()',TempSpeed)}} function picrun_ini(){ GetObj("List2_1").innerHTML=GetObj("List1_1").innerHTML; GetObj('ISL_Cont_1').scrollLeft=fill_1>=0?fill_1:GetObj('List1_1').scrollWidth-Math.abs(fill_1); GetObj("ISL_Cont_1").onmouseover=function(){clearInterval(AutoPlayObj_1)} GetObj("ISL_Cont_1").onmouseout=function(){AutoPlay_1()} AutoPlay_1(); } //产品展示滚动图片结束 //--> </script> <style type="text/css"> <!-- BODY { BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 0px; MARGIN: 0px; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #fff; BORDER-RIGHT-WIDTH: 0px } .blk_18 { BORDER-RIGHT: #e3e3e3 1px solid; BORDER-TOP: #e3e3e3 1px solid; MARGIN-TOP: 8px; FONT-SIZE: 12px; BACKGROUND: #f3f3f3; OVERFLOW: hidden; BORDER-LEFT: #e3e3e3 1px solid; WIDTH: 390px; BORDER-BOTTOM: #e3e3e3 1px solid; ZOOM: 1 } .blk_18 .pcont { FLOAT: left; OVERFLOW: hidden; WIDTH: 350px } .blk_18 .ScrCont { WIDTH: 32766px; ZOOM: 1 } .blk_18 #List1_1 { FLOAT: left } .blk_18 #List2_1 { FLOAT: left } .blk_18 .LeftBotton { BACKGROUND: url(http://img.china.alibaba.com/images/unsort/module/picr_1.gif) no-repeat; FLOAT: left; MARGIN: 10px 1px; WIDTH: 15px; HEIGHT: 72px } .blk_18 .RightBotton { BACKGROUND: url(http://img.china.alibaba.com/images/unsort/module/picr_1.gif) no-repeat; FLOAT: left; MARGIN: 10px 1px; WIDTH: 15px; HEIGHT: 72px } .blk_18 .LeftBotton { BACKGROUND-POSITION: 0px 0px; MARGIN-LEFT: 5px } .blk_18 .RightBotton { BACKGROUND-POSITION: 0px -100px; MARGIN-LEFT: -1px } .blk_18 .LeftBotton:hover { BACKGROUND-POSITION: -20px 0px } .blk_18 .RightBotton:hover { BACKGROUND-POSITION: -20px -100px } .blk_18 .pl IMG { DISPLAY: block; MARGIN: 6px auto 1px; CURSOR: pointer; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none } .blk_18 .pl { BORDER-RIGHT: #f3f3f3 1px solid; BORDER-TOP: #f3f3f3 1px solid; FLOAT: left; BORDER-LEFT: #f3f3f3 1px solid; WIDTH: 114px; LINE-HEIGHT: 24px; BORDER-BOTTOM: #f3f3f3 1px solid; TEXT-ALIGN: center; TEXT-DECORATION: underline } .blk_18 A.pl:hover { BORDER-RIGHT: #ff9900 1px solid; BORDER-TOP: #ff9900 1px solid; BACKGROUND: #fff; BORDER-LEFT: #ff9900 1px solid; COLOR: #ff9900; BORDER-BOTTOM: #ff9900 1px solid } .commu_cont3 { MARGIN: 9px 7px 7px; LINE-HEIGHT: 150% } .commu_cont3 UL { WIDTH: 188px } --> </style> </head> <body> <!-- picrotate_left start --> <DIV class=blk_18> <A onmouseup=ISL_StopUp_1() class=LeftBotton onmousedown=ISL_GoUp_1() onmouseout=ISL_StopUp_1() href="javascript:void(0);" target=_self></A> <DIV class=pcont id=ISL_Cont_1> <DIV class=ScrCont> <DIV id=List1_1><!-- piclist begin --> <A class=pl href="http://www.wubaili.com" target=_blank><IMG height=72 alt=20-50元夏装抢疯 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://www.yiwuku.com" target=_blank><IMG height=72 alt=韩国人气小耳环 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v9-d1002531301.html" target=_blank><IMG height=72 alt=3万6超值装修88平 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v8-d1002530067.html" target=_blank><IMG height=72 alt=牛干巴敲开财富门 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v5003519-d1002285304.html" target=_blank><IMG height=72 alt=4K至7K高性能本本 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v5001800-d1002511645.html" target=_blank><IMG height=72 alt=7万装修102平婚房 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v5003463-d1002527336.html" target=_blank><IMG height=72 alt=最新小车节油为主 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v5003000-d1002505656.html" target=_blank><IMG height=72 alt="热门项目 BT烤翅" src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <A class=pl href="http://info.china.alibaba.com/news/detail/v3000103-d1002421590.html" target=_blank><IMG height=72 alt=流行T恤+裤装 src="http://www.baidu.com/img/baidu_logo.gif" width=96></A> <!-- piclist end --> </DIV> <DIV id=List2_1></DIV> </DIV> </DIV><A onmouseup=ISL_StopDown_1() class=RightBotton onmousedown=ISL_GoDown_1() onmouseout=ISL_StopDown_1() href="javascript:void(0);" target=_self></A> </DIV> <SCRIPT type=text/javascript> <!-- picrun_ini() //--> </SCRIPT> <!-- picrotate_left end --> </body> </html>
<DIV id=demo style="BACKGROUND: #ffffff; OVERFLOW: hidden; WIDTH: 150px; COLOR: #0000ff; HEIGHT: 200px"> <DIV id=demo1> <div align="center"> <A href="http://www.dream68.cn"><IMG src="/image/logo.gif" height=50 border=0></A><br> <A href="http://www.dream68.cn"><IMG src="/image/logo.gif" height=50 border=0></A><br> <A href="http://www.dream68.cn"><IMG src="/image/logo.gif" height=50 border=0></A><br> <A href="http://www.dream68.cn"><IMG src="/image/logo.gif" height=50 border=0></A><br><A href="http://www.dream68.cn"><IMG src="/image/logo.gif" height=50 border=0></A> </div> </DIV> <DIV id=demo2></DIV> </DIV> <SCRIPT language="javascript"> var speed=50; demo2.innerHTML=demo1.innerHTML; function Marquee(){ if(demo2.offsetTop-demo.scrollTop<=0){ demo.scrollTop-=demo1.offsetHeight; } else{ demo.scrollTop++; } } var MyMar=setInterval(Marquee,speed); demo.onmouseover=function() {clearInterval(MyMar)}; demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}; </SCRIPT>
<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <FCK:meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>www.wubaili.com</title> <style> #sl{ background: url("http://assets.taobaocdn.com/app/tc/img/decorate.png") -106px -105px; height: 63px; width: 19px; right: 50px; position: absolute; display: none; } #sl a{ display: block; height: 63px; width: 19px; } </style> <script type="text/javascript"> <!-- var $ = function(o){return document.getElementById(o);} window.onload = function(){ window.onscroll = function(){ var scrollTop = document.documentElement.scrollTop + document.body.scrollTop; if(scrollTop){ $("sl").style.display = 'block'; $("sl").style.top = (scrollTop + document.documentElement.clientHeight - 80) + "px"; }else{ $("sl").style.display = 'none'; } } } //--> </script> </head> <body> <P>宠物狗的定义</P> <P>宠物狗,指的是适合家庭饲养的犬种,是以为人类提供乐趣、玩伴、守护、警戒为主要目的。</P> <P>狗是地球上分布最广的动物之一,据不完全统计其种类多达数千种,而宠物狗只占其中很小的一部分。了解哪些狗适合作为宠物饲养是十分必要的,因为如果选择不当,可能会伤及儿童,甚至打消对狗的乐趣。</P> <P>常见的宠物狗大约有300多种,其中包括:迷你雪纳瑞、罗威士梗、西部高地白梗、中国冠毛犬、日本狆北京犬、马尔济斯犬、曼彻斯特梗 八哥犬 拳师犬 约克夏比格犬、波士顿梗、可卡犬、法国斗牛犬、拉萨犬、波利犬、澳洲牧牛犬、比利时牧羊犬、狐狸犬、威斯拉犬、威玛猎犬、喜乐蒂牧羊犬、伯恩山犬、纽芬兰犬、惠比特犬、长须牧羊犬等。</P> <P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P><P>宠物狗的挑选方法</P> <P>*血统是否纯正,商家是否能提供相关证书。</P> <P>*是否活泼机灵,是否乐于和人类为伴,尤其是孩子。</P> <P>*尽量挑选性格温和的,体型不宜过大。</P> <P>*颊须和颁须都应长而丰满,眼睛要有神,见了主人要不畏缩,且能勇敢而机警。</P> <P>*体质要求健壮,不能带有任何轻微疾病;肛门周围有黄渍或粘有粪便者不能入选。</P> <P>*毛色应以白色或白色中带有柠檬色的为合适,除头部五官黑色之外,其他部分黑色过多的最好不入选。</P> <P>*眼睛小而色浅,鼻色白或呈樱桃色或有斑点,耳朵直立或耳形不正,口颌不正,这些都不合此犬的体形标准。</P> <P>*头颈粗短而腿长,被毛柔细而卷曲像羊毛,牙齿呈钳式或虎式咬合的,也不符此宠物狗的形体标准。</P><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />本文转自[我就要美丽网_美丽女人之家] www.591meili.com转载请注明出处。 <div id="sl"> <a href="#" _fcksavedurl="#"></a> </div> </body> </html>
有做修正
这个记在这,留个记号
http://www.oncity.cc/p/test/jquery/search.html
jquery搜索提示的
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery 自动完成功能(优化版)</title> <script type="text/javascript" src="jquery-1.3.1.js"></script> </head> <body> <script type="text/javascript"> var highlightindex = -1;//表示当前高亮节点 var timeoutId; $(document).ready(function() { var wordInput = $("#word");//文本框 var wordInputOffset = wordInput.offset();//获得文本框位置 $("#auto").hide().css("border", "1px black solid").css("position", "absolute") .css("top", wordInputOffset.top + wordInput.height() + 5 + "px") .css("left", wordInputOffset.left + "px").width(wordInput.width() + 3 + "px"); wordInput.blur(function() { autoHide(); }); wordInput.keyup(function(event) { //处理文本框中的键盘事件 //如果输入字母,将文本框中最新信息发送给服务器 var myEvent = event || window.event; var keyCode = myEvent.keyCode;//获得键值 if (keyCode == 27) { var wordText = $("#word").val(); autoHide(); wordInput.text(wordText); } else { if (keyCode >= 65 && keyCode <= 90 || keyCode == 8 || keyCode == 46 || keyCode == 32) { //8对应退格键,46对应删除键 var wordText = $("#word").val();//获得文本框中的内容 var autoNode = $("#auto"); if (wordText != "") { clearTimeout(timeoutId);//对上次未完成的延时操作进行取消 //延时操作,减少与服务器的交互次数,延时500ms,防止用户操作过快 timeoutId = setTimeout(function() { $.post("http://www.oncity.cc/p/test/jquery/search_result.php", {word:wordText}, function(data) { if($("#word").val() =="" ) { autoHide(); return; } var jqueryObj = $(data);//将dom对象data转换成jQuery的对象 var wordNodes = jqueryObj.find("word");//找到所有word节点 autoNode.html(""); wordNodes.each(function(i) { //i是索引,用来给id赋值 var wordNode = $(this);//获取单词内容 var newDivNode = $("<div>").attr("id", i).css("backgroundColor", "white"); newDivNode.html(wordNode.text()).appendTo(autoNode);//新建div节点,加入单词内容 //增加鼠标进入事件,高亮节点 newDivNode.mouseover(function() { //将原来高亮的节点取消高亮 if (highlightindex != -1) { $("#auto").children("div").eq(highlightindex) .css("backgroundColor", "white"); } //记录新的高亮索引 highlightindex = $(this).attr("id"); $(this).css("backgroundColor", "#3366CC").css("cursor","pointer"); }); //增加鼠标移出事件,取消节点高亮 newDivNode.mouseout(function() { if (keyCode == 13) { //判断是否按下回车键 //下拉框有高亮 if (highlightindex != -1) { lightEventHide(); highlightindex = -1; } else { alert("文本框中的[" + $("#word").val() + "]被提交了"); autoHide(); $("#word").get(0).blur();//让文本框失去焦点 } //取消鼠标移出节点的高亮 //$(this).css("backgroundColor", "white"); } } ); //增加鼠标点击事件,可以进行补全 newDivNode.click(function() { //取出高亮节点的文本内容 var comText = $(this).text(); autoHide(); highlightindex = -1; //文本框内容变为高亮节点内容 $("#word").val(comText); }); }); //添加单词内容到弹出框 if (wordNodes.length > 0) { autoNode.show(); } else { autoNode.hide(); highlightindex = -1;//弹出框隐藏,高亮节点索引设成-1 } }, "xml"); }, 300); } else { autoNode.hide(); highlightindex = -1; } } else if (keyCode == 38 || keyCode == 40) { //判断是否输入的是向上38向下40按键 if (keyCode == 38) { var autoNodes = $("#auto").children("div").css("background-color", "white"); if (highlightindex != -1) { autoNodes.eq(highlightindex).css("background-color", "white"); highlightindex--; } else { lightEvent(); highlightindex = autoNodes.length - 1; } if (highlightindex == -1) { highlightindex = autoNodes.length - 1;//如果改变索引值后index变成-1,则将索引值指向最后一个元素 } lightEvent(); autoNodes.eq(highlightindex).css("backgroundColor", "#3366CC"); } if (keyCode == 40) { var autoNodes = $("#auto").children("div"); if (highlightindex != -1) { autoNodes.eq(highlightindex).css("background-color", "white"); } highlightindex++; if (highlightindex == autoNodes.length) { highlightindex = 0;//如果改变索引值等于最大长度,则将索引值指向第一个元素 } lightEvent(); autoNodes.eq(highlightindex).css("backgroundColor", "#3366CC"); } } else if (keyCode == 13) { //判断是否按下回车键 //下拉框有高亮 if (highlightindex != -1) { lightEventHide(); highlightindex = -1; } else { alert("文本框中的[" + $("#word").val() + "]被提交了"); $("#auto").hide(); $("#word").get(0).blur();//让文本框失去焦点 } //下拉框没有高亮 } } } ) ; $("input[type='button']").click(function() { alert("文本框中的[" + $("#word").val() + "]被提交了"); }); }); function lightEventHide(){ var comText = $("#auto").hide().children("div").eq(highlightindex).text(); $("#word").val(comText); } function lightEvent(){ var comText = $("#auto").children("div").eq(highlightindex).text(); $("#word").val(comText); } function autoHide(){ $("#auto").hide(); } </script> <h3> <center>智能搜,打个 win 或 曼 字看看</center> </h3> <br /> <table align="center"> <tr><td> <input type="text" id="word" maxlength=2048 size=55 /> <br/> <td></tr> <tr><td align="center"> <input type="button" value="OnCity 智能搜索"/> </td></tr> </table> <br /> <div id="auto"></div> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <HTML xml:lang="zn" xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <TITLE>浮动层居中的对话框效果演示</TITLE> <META http-equiv=content-type content="application/xhtml+xml; charset=gb2312"> <STYLE type=text/css> HTML { HEIGHT: 100% } BODY { HEIGHT: 100% } BODY { FONT-SIZE: 14px; FONT-FAMILY: Tahoma, Verdana, sans-serif } DIV.neat-dialog-cont { Z-INDEX: 98; BACKGROUND: none transparent scroll repeat 0% 0%; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100% } DIV.neat-dialog-bg { Z-INDEX: -1; FILTER: alpha(opacity=70); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; BACKGROUND-COLOR: #eee; opacity: 0.7 } DIV.neat-dialog { BORDER-RIGHT: #444 1px solid; BORDER-TOP: #444 1px solid; Z-INDEX: 99; MARGIN-LEFT: auto; BORDER-LEFT: #444 1px solid; WIDTH: 30%; MARGIN-RIGHT: auto; BORDER-BOTTOM: #444 1px solid; POSITION: relative; TOP: 25%; BACKGROUND-COLOR: #fff } DIV.neat-dialog-title { PADDING-RIGHT: 0.3em; PADDING-LEFT: 0.3em; FONT-SIZE: 0.8em; PADDING-BOTTOM: 0.1em; MARGIN: 0px; LINE-HEIGHT: 1.2em; PADDING-TOP: 0.1em; BORDER-BOTTOM: #444 1px solid; POSITION: relative } IMG.nd-cancel { RIGHT: 0.2em; POSITION: absolute; TOP: 0.2em } DIV.neat-dialog P { PADDING-RIGHT: 0.2em; PADDING-LEFT: 0.2em; PADDING-BOTTOM: 0.2em; PADDING-TOP: 0.2em; TEXT-ALIGN: center } </STYLE> <SCRIPT type=text/javascript> function NeatDialog(sHTML, sTitle, bCancel) { window.neatDialog = null; this.elt = null; if (document.createElement && document.getElementById) { var dg = document.createElement("div"); dg.className = "neat-dialog"; if (sTitle) sHTML = '<div class="neat-dialog-title">'+sTitle+ ((bCancel)? '<img src="x.gif" alt="Cancel" class="nd-cancel" />':'')+ '</div>\n' + sHTML; dg.innerHTML = sHTML; var dbg = document.createElement("div"); dbg.id = "nd-bdg"; dbg.className = "neat-dialog-bg"; var dgc = document.createElement("div"); dgc.className = "neat-dialog-cont"; dgc.appendChild(dbg); dgc.appendChild(dg); //adjust positioning if body has a margin if (document.body.offsetLeft > 0) dgc.style.marginLeft = document.body.offsetLeft + "px"; document.body.appendChild(dgc); if (bCancel) document.getElementById("nd-cancel").onclick = function() { window.neatDialog.close(); }; this.elt = dgc; window.neatDialog = this; } } NeatDialog.prototype.close = function() { if (this.elt) { this.elt.style.display = "none"; this.elt.parentNode.removeChild(this.elt); } window.neatDialog = null; } function openDialog() { var sHTML = '<p>西西<a target="_blank" href="/" class="wordstyle">WEB开发</a>脚本特效集演示中心,<a href="">国内最大的<a target="_blank" href="/" class="wordstyle">WEB开发</a>资源社区!</p>'+ '<p><button onclick="window.neatDialog.close()">关闭!</button></p>'; new NeatDialog(sHTML, "欢迎光临!", false); } </SCRIPT> <META content="MSHTML 6.00.3790.630" name=GENERATOR></HEAD> <BODY> <H1>浮动层居中的对话框效果演示</H1> <BUTTON onclick=openDialog()>演示层提示效果</BUTTON> </BODY></HTML>
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> *{margin:0;padding:0;} </style> </head> <body> <p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p> <p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p><p>测试</p> <input type="button" value="点击这里" onclick="sAlert('测试效果<br/>嗯!效果还不错!');" /> <script type="text/javascript" language="javascript"> function sAlert(str){ var msgw,msgh,bordercolor; msgw=400;//提示窗口的宽度 msgh=100;//提示窗口的高度 titleheight=25 //提示窗口标题高度 bordercolor="#336699";//提示窗口的边框颜色 titlecolor="#99CCFF";//提示窗口的标题颜色 var sWidth,sHeight; sWidth=document.body.offsetWidth;//浏览器工作区域内页面宽度 sHeight=screen.height;//屏幕高度(垂直分辨率) //背景层(大小与窗口有效区域相同,即当弹出对话框时,背景显示为放射状透明灰色) var bgObj=document.createElement("div");//创建一个div对象(背景层) //定义div属性,即相当于 //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></div> bgObj.setAttribute('id','bgDiv'); bgObj.style.position="absolute"; bgObj.style.top="0"; bgObj.style.background="#777"; bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; bgObj.style.opacity="0.6"; bgObj.style.left="0"; bgObj.style.width=sWidth + "px"; bgObj.style.height=sHeight + "px"; bgObj.style.zIndex = "10000"; document.body.appendChild(bgObj);//在body内添加该div对象 var msgObj=document.createElement("div")//创建一个div对象(提示框层) //定义div属性,即相当于 //<div id="msgDiv" align="center" style="background-color:white; border:1px solid #336699; position:absolute; left:50%; top:50%; font:12px/1.6em Verdana,Geneva,Arial,Helvetica,sans-serif; margin-left:-225px; margin-top:npx; width:400px; height:100px; text-align:center; line-height:25px; z-index:100001;"></div> msgObj.setAttribute("id","msgDiv"); msgObj.setAttribute("align","center"); msgObj.style.background="white"; msgObj.style.border="1px solid " + bordercolor; msgObj.style.position = "absolute"; msgObj.style.left = "50%"; msgObj.style.top = "50%"; msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; msgObj.style.marginLeft = "-225px" ; msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; msgObj.style.width = msgw + "px"; msgObj.style.height =msgh + "px"; msgObj.style.textAlign = "center"; msgObj.style.lineHeight ="25px"; msgObj.style.zIndex = "10001"; var title=document.createElement("h4");//创建一个h4对象(提示框标题栏) //定义h4的属性,即相当于 //<h4 id="msgTitle" align="right" style="margin:0; padding:3px; background-color:#336699; filter:progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100); opacity:0.75; border:1px solid #336699; height:18px; font:12px Verdana,Geneva,Arial,Helvetica,sans-serif; color:white; cursor:pointer;" onclick="">关闭</h4> title.setAttribute("id","msgTitle"); title.setAttribute("align","right"); title.style.margin="0"; title.style.padding="3px"; title.style.background=bordercolor; title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; title.style.opacity="0.75"; title.style.border="1px solid " + bordercolor; title.style.height="18px"; title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; title.style.color="white"; title.style.cursor="pointer"; title.innerHTML="关闭"; title.onclick=removeObj; var button=document.createElement("input");//创建一个input对象(提示框按钮) //定义input的属性,即相当于 //<input type="button" align="center" style="width:100px; align:center; margin-left:250px; margin-bottom:10px;" value="关闭"> button.setAttribute("type","button"); button.setAttribute("value","关闭"); button.style.width="60px"; button.style.align="center"; button.style.marginLeft="250px"; button.style.marginBottom="10px"; button.style.background=bordercolor; button.style.border="1px solid "+ bordercolor; button.style.color="white"; button.onclick=removeObj; function removeObj(){//点击标题栏触发的事件 document.body.removeChild(bgObj);//删除背景层Div document.getElementById("msgDiv").removeChild(title);//删除提示框的标题栏 document.body.removeChild(msgObj);//删除提示框层 } document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj document.getElementById("msgDiv").appendChild(title);//在提示框div中添加标题栏对象title var txt=document.createElement("p");//创建一个p对象(提示框提示信息) //定义p的属性,即相当于 //<p style="margin:1em 0;" id="msgTxt">测试效果</p> txt.style.margin="1em 0" txt.setAttribute("id","msgTxt"); txt.innerHTML=str;//来源于函数调用时的参数值 document.getElementById("msgDiv").appendChild(txt);//在提示框div中添加提示信息对象txt document.getElementById("msgDiv").appendChild(button);//在提示框div中添加按钮对象button } </script> </body> </html>
<script> function show(username) { document.all.userinfo.innerHTML='信息读取中...'; document.all.userinfo.style.display="block"; document.all.userinfo.style.left=event.x; document.all.userinfo.style.top=document.body.scrollTop+event.y; //xajax_getlyuserinfo(username); //异步处理,生成卡片 } </script> <div id="userinfo" style="position:absolute;z-index:100;left:15px;top:180px;display:none;border:1px solid #dddddd;background-color:#eeeeee;width:250px;height:102" onmouseout='document.all.userinfo.style.display="none"' onmouseover='document.all.userinfo.style.display="block"'></div>然后调用时用经过或是点击什么的就行了
<body> 页面代码: <div id="menu1" onclick="TreeMenu(this,'child1')"> <img src="plus.gif" ><a href="#">菜单1</a> </div> <div id="child1" style="display:none"> <a href="#">页面1</a><br> <a href="#">页面2</a> </div> <div id="menu2" onclick="TreeMenu(this,'child2')"> <img src="plus.gif"><a href="#">菜单2</a> </div> <div id="child2" style="display:none"> <a href="#">页面1</a><br> <a href="#">页面2</a> </div> <script language=javascript> function TreeMenu(node,id) { var sibling = document.getElementById(id); if (sibling.style.display == 'none') { if (node.childNodes.length > 0) { if (node.childNodes[0].tagName == "IMG") { node.childNodes[0].src = "minus.gif"; //替换为展开时的图片 } } sibling.style.display = ''; } else { if (node.childNodes.length > 0) { if (node.childNodes[0].tagName == "IMG") { node.childNodes[0].src = "plus.gif"; //替换为 } } sibling.style.display = 'none'; } } </script> </body>