现在的位置: 首页 > 综合 > 正文

js常用实例:qq。。。

2012年04月02日 ⁄ 综合 ⁄ 共 9694字 ⁄ 字号 评论关闭

1.网页上显示qq的状态,点击后即可聊天,无须是好友

<a target="_blank" href="http://wpa.qq.com/msgrd?V=1&Uin=*******&Site=ioshenmue&Menu=yes"><img src="http://wpa.qq.com/pa?p=1:*******:1"
border="0"></a>

‘*’处换成在线的qq号即可

 

两种状态

点击后:

 

2.划词百度搜索功能

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>

<SCRIPT language=javascript>
<!--
document.body.onload=adddiv;
document.onmousedown=recordobj;
document.ondblclick=dbclick;
document.onmouseup=showselect;
var starobj,isdb=false,allow=true;
function isallow()
{
if(allow){
allow=false;
alert('划词搜索已关闭');
}
else{
allow=true;
alert('恭喜你,划词搜索已为你打开,选中任意词组或字可以进行搜索!');
}
}
function dbclick()
{
isdb=true;
}
function recordobj()
{
starobj=event.srcElement;
}
function showselect() {
var str="";
if(event.srcElement.tagName!="A"&&event.srcElement.tagName!="INPUT"&&event.srcElement==starobj&&!isdb&&allow)
{
var oText=document.selection.createRange();
if(oText.text.length>0)
{
str=oText.text;
oText.text="BuB"+oText.text+"EuE";
}

oText.select();
event.srcElement.innerHTML=event.srcElement.innerHTML.replace("BuB","<u style='FONT-WEIGHT: bold;COLOR: #ff3366'>").replace("EuE","</u>");
}
searchgoogle(str)
isdb=false;
}
function searchbaidu(str)
{
var obj=document.getElementById("searchbaidu");
if(str.length>0)
{
obj.style.display="block";
obj.style.position="absolute";
obj.style.zindex=999;
obj.style.posTop=document.body.scrollTop+event.y-25;
obj.style.posLeft=document.body.scrollLeft+event.x+5;
obj.style.widht=80;
obj.innerHTML="<a target=_blank href=http://www.baidu.com/baidu?word="+str+" style='BORDER-RIGHT: #fff1ca thin solid; BORDER-TOP: #fff1ca thin solid; FONT-WEIGHT: bold; BORDER-LEFT: #fff1ca thin solid; CLIP: rect(auto auto auto auto); COLOR: #666666; BORDER-BOTTOM:
royalblue thin solid; BACKGROUND-COLOR: #fff1ca; TEXT-DECORATION: none'>这是什么?</a>";
}
else
{
obj.style.display="none";
}
}
function adddiv()
{
var mobj = document.createElement("div");
mobj.id="searchbaidu";
document.body.appendChild(mobj);
}
//BY QPSH.COM-->
</SCRIPT>
<INPUT type="button" onclick="isallow()" value="关闭/打开划词功能">

篮球,dota

</body>
</html>

 

3.标签切换(参考WWW.QPSH.COM

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效 WWW.QPSH.COM</title>
<style>
body {
 font-family: "宋体";
 font-size: 12px;
 color: #525252;
}
td {
 font-family: "宋体";
 font-size: 12px;
 color: #525252;
}
a:link {
 color: #525252;
 font-size: 12px;
 text-decoration: none;
}
a:visited{
 color: #525252;
 font-size: 12px;
 text-decoration: none;
}
a:hover {
 color: #ff6600;
 font-size: 12px;
 text-decoration: underline;
}
.gd1{
 font-family: "宋体";
 font-size: 12px;
 color: #ff0000;
}

.sec11 {BORDER-RIGHT: #C5E1FE 1px solid; BORDER-TOP: #C5E1FE 1px solid; BORDER-LEFT: #C5E1FE 1px solid; CURSOR: hand; COLOR: #01499A; BORDER-BOTTOM: #C5E1FE 1px solid; BACKGROUND-COLOR: #ffffff}
.sec21 {BORDER-RIGHT: #C5E1FE 1px solid; BORDER-TOP: #C5E1FE 1px solid; FONT-WEIGHT: 800;color:#01499A; BORDER-LEFT: #C5E1FE 1px solid;BORDER-BOTTOM: #C5E1FE 1px solid; CURSOR: hand; BACKGROUND-COLOR: #E6EEF7;BACKGROUND:url('/icon/098.gif') no-repeat}
.main_tab {BACKGROUND-COLOR: #ffffff}
</style>
<!--JavaScript部分-->
<SCRIPT language=javascript>
function secBoard(n)
  {
    for(i=0;i<secTable.cells.length;i++)
      secTable.cells

[i].className="sec11";
    secTable.cells[n].className="sec21";
    for(i=0;i<mainTable.tBodies.length;i++)
      mainTable.tBodies

[i].style.display="none";
    mainTable.tBodies

[n].style.display="block";
  }
</SCRIPT>
</head>

<body>
<p align="center">这里便于演示,只设置了两个栏目切换,你可以根据需要,自行增加栏目!修改CSS使它更适合你的网站<br>
<br>
<a target="_blank" href="http://www.qpsh.com/">有问题请看这里</a></p>
<div align="center">
       <table border="0" width="200" cellpadding="0" cellspacing="0" style="border-collapse: collapse" height="145" id="table7" bgcolor=#ecf5ff>
        <tr>
         <td height="145">
         <div align="center">
          <table border="0" width="200" cellpadding="0" style="border-collapse: collapse" height="140" id="table107">
           <tr>
            <td height="25">
            <div align="center">
             <table border="0" width="220" cellpadding="0" style="border-collapse: collapse" height="22" id=secTable>
              <tr>
               <td class=sec21 onmouseover=secBoard(0) width="50%">
               <p align="center">菜单特效</td>
               <td class=sec11 onmouseover=secBoard(1) width="50%">
               <p align="center">网页特效简介</td>
              </tr>
             </table>
            </div>
            </td>
           </tr>
           <tr>
            <td height="115">
            <div align="center">
             <table id=mainTable border="0" width="195" cellpadding="0" style="border-collapse: collapse" height="115">
             <TBODY style="DISPLAY: block"><tr>
               <td height="145"><div align="center">
       <table border="0" width="205" cellpadding="0" style="border-collapse: collapse" height="138">
        <tr>
         <td height="23" width="15" valign="middle">
            ·</td>
         <td height="23" width="180">
         <a target="_blank" style="color: #01499a" href="http://www.qpsh.com/javascript/showpage2277.htm">超酷XP风格网页右键菜单</a></td>
        </tr>
        <tr>
         <td height="23" width="15">
            ·</td>
         <td height="23" width="180">
         <a target="_blank" style="color: #01499a" href="http://www.qpsh.com/javascript/showpage2276.htm">通用3级联动菜单</a></td>
        </tr>
        <tr>
         <td height="23" width="15">
            ·</td>
         <td height="23" width="180">
         <a target="_blank" style="color: #01499a" href="http://www.qpsh.com/javascript/showpage2275.htm">相当好玩的右键弹出菜单</a></td>
        </tr>
        <tr>
         <td height="23" width="15">
            ·</td>
         <td height="23" width="180">
         <a target="_blank" style="color: #01499a" href="http://www.qpsh.com/javascript/showpage2274.htm">用CSS设计的纵向导航条实例</a></td>
        </tr>
        <tr>
         <td height="23" width="15">
            ·</td>
         <td height="23" width="180">
         <a target="_blank" style="color: #01499a" href="http://www.qpsh.com/javascript/showpage2272.htm">将网站设为首页的代码</a></td>
        </tr>
        <tr>
         <td height="23" width="195" colspan="2">
            <p align="right"><font color="#01499A">
            <a target="_blank" href="http://www.qpsh.com/listpage/102_1.htm">
            <font color="#01499A">更多</font><font color="#01499A" face="Arial">>>></font></a></font></td>
         </tr>
        </table>
      </div></td>
              </tr></TBODY>
              <TBODY style="DISPLAY: none"><tr>
               <td height="145"><div align="center">
       <table border="0" width="205" cellpadding="0" style="border-collapse: collapse" height="138">
        <tr>
         <td height="138" width="195" style="line-height: 150%">
               
            <b>
            <a target="_blank" href="http://www.qpsh.com/">网页特效</a></b>是用程序代码在网页中实现特殊效果或者特殊功能的一种技术,它为网页活跃了气氛,增加了网站的亲和力。为网页添加特效,学会添加<a target="_blank" href="http://www.qpsh.com/">网页特效</a>的过程能从一定程度上激发网页初学者更加了解HTML语言的结构。</td>
        </tr>
        </table>
      </div></td>
              </tr></TBODY>
             </table>
            </div>
            </td>
           </tr>
          </table>
         </div>
         </td>
        </tr>
        </table>
      </div>
</body>

</html>

本代码由<a href=http://www.qpsh.com>网页特效网</a>提供

4.简单的删除确认

<script language="">
function winconfirm(){
    question = confirm("你将删除这个用户,该操作不可恢复,确认吗?")
    if (question != "0"){
        window.open("http://www.dota.com")
    }
}
</script>

<a href="javascript:winconfirm()">删除</a>

 

5.

01、让背景图不滚动

IE浏览器支持一个 Body 属性 bgproperties,它可以让背景不滚动:

<Body Background="图片文件" bgproperties="fixed">

02、让你的网页无法另存为

<noscript><iframe src=*></iframe></noscript>

03、让IFRAME框架内的文档的背景透明

<iframe src="about:<body style=‘background:transparent‘>" allowtransparency></iframe>

04、禁止右键:

<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">

05、进入页面后立即自动刷新?

<meta http-equiv="refresh" content="120;url=http://www.qpsh.com">

http://www.qpsh.com,这是你自己的网址。

06、打开窗口即最大化

<script language="JavaScript">

  <!-- Begin

  self.moveTo(0,0)

  self.resizeTo(screen.availWidth,screen.availHeight)

  // End -->

</script>

07、能隐藏IFRAME的滚动条吗?我知道的三种方法:

(1)、设置iframe scrolling="no"

(2)、被包含页body应用overflow:hidden

(3)、被包含页的body标签加scroll="no"

08、加入背景音乐

<bgsound src="mid/windblue[1].mid" loop="-1"> 只适用于IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 对Netscape ,IE ,TT都适用

09、嵌入网页

<iframe name="tt" src="01a.html" width="450" height="287" scrolling="Auto" frameborder="0"></iframe>

10、跳转

<meta http-equiv="refresh" content="3;URL=list.htm">

11、滚动
<MARQUEE direction=up height=146 onmouseout=start() onmouseover=stop() scrollAmount=4></marquee>

12、细线分隔线

<hr noshade size=0 color=#C0C0C0>

13、过度方式

<meta http-equiv="Page-Exit" content="revealTrans(Duration=3,Transition=5)">

Duration的值为网页动态过渡的时间,单位为秒。

Transition是过渡方式,它的值为0到23,分别对应24种过渡方式。如下表:

0 盒状收缩 1 盒状放射

2 圆形收缩 3 圆形放射

4 由下往上 5 由上往下

6 从左至右 7 从右至左

8 垂直百叶窗 9 水平百叶窗

10 水平格状百叶窗 11垂直格状百叶窗

12 随意溶解 13从左右两端向中间展开

14从中间向左右两端展开 15从上下两端向中间展开

16从中间向上下两端展开 17 从右上角向左下角展开

18 从右下角向左上角展开 19 从左上角向右下角展开

20 从左下角向右上角展开 21 水平线状展开

22 垂直线状展开 23 随机产生一种过渡方式

15、如何控制横向和纵向滚动条的显隐?

<body style="overflow-y:hidden"> 去掉x轴
<body style="overflow-x:hidden"> 去掉y轴
<body scroll="no">不显

16、怎样在 FrontPage2000 中加入 Flash 动画?

在 FrontPage2000 中,点击[插入]->[高级]->[插件],在弹出的窗口中,设置一下 Flash 文件的大小及其它信息,确定即可。

17、加入注释的格式是:
<!-[注释内容…]-->

18、怎样在网页中加入 E-mail 链接并显示预定的主题?

<A href="mailto:Email@263.net?subject=主题">……</a>

19、定义本网页关键字,可以在<Head></Head>中加入如下代码:

<meta name="Keywords" content="china,网页特效园地,business,net">

Content 中所包含的就是关键字,你可以自行设置。

这里有个技巧,你可以重复某一个单词,这样可以提高自己网站的排行位置,如:

<meta name="Keywords" content="china,china,china,china">

20、添加到收藏夹:

<a href="javascript:window.external.addFavorite(‘http://链接‘,‘说明‘);">添加到收藏夹</a>

21、设为首页:

<a href=# onclick=this.style.behavior=‘url(#default#homepage)‘;this.setHomePage(‘http://链接‘);>设为首页</a>

22、定制浏览器地址栏前的小图标:

A:在网页的<head></head>间加入以下语句:

link rel="shortcuticon" href="http://…/icon.ico">

即可。其中 icon.ico 为 16x16 的图标文件,颜色不要超过 16 色。

23、把滚动条放在浏览器窗口的左边

A:在 <body> 中加 dir=RTL,即 <body dir=RTL>。

继续更新中。。。。

抱歉!评论已关闭.