部分网页技巧代码集

网页对话框
<html>
<SCRIPT LANGUAGE=javascript>
<!--
showModalDialog('http://www.dingl.com <;/b>
</body>
</html>
  showModalDialog()或是showModelessDialog() 来调用网页对话框,至于showModalDialog()与showModelessDialog()的区别,在于showModalDialog()打开的窗口(简称模式窗口),置在父窗口上,必须关闭才能访问父窗口(建议尽量少用,以免招人反感);showModelessDialog()(简称无模式窗口),打开后不必关闭也可访问父窗口打开的窗口。
dialogHeight: iHeight 设置对话框窗口的高度。
dialogWidth: iWidth 设置对话框窗口的宽度。   
dialogLeft: iXPos 设置对话框窗口相对于桌面左上角的left位置。
dialogTop: iYPos 设置对话框窗口相对于桌面左上角的top位置。
center: {yes | no | 1 | 0 } 指定是否将对话框在桌面上居中,默认值是“yes”。
help: {yes | no | 1 | 0 } 指定对话框窗口中是否显示上下文敏感的帮助图标。默认值是“yes”。   
resizable: {yes | no | 1 | 0 } 指定是否对话框窗口大小可变。默认值是“no”。
status: {yes | no | 1 | 0 } 指定对话框窗口是否显示状态栏。对于非模式对话框窗口,默认值是“yes”;对于模式对话框窗口,默认值是 “no”。
网页经典代码
1. 将彻底屏蔽鼠标右键,无右键菜单
<body οncοntextmenu=window.event.returnvalue=false>

 

也可以用于网页中Table框架中
<table border οncοntextmenu=return(false)><td>no</table>
2.取消选取、防止复制
<body onselectstart=return false>
3.不准粘贴
<body οnpaste=return false>
4.防止复制
<body οncοpy=return false; oncut=return false;>
5.IE地址栏前换成自己的图标
<link rel=Shortcut Icon href=favicon.ico>
说明:关于favicon.ico文件的制作。你可以先在FW中做一个图片,属于你自己站点一个小图标。然后在ACD see将文件属性改为*.ico,然后将你做的*.ICO文件传到你的服务器目录中,然后就可以使用以上代码来实现,当别人登陆你的站点时,地址栏里使用的就是你自定义的图标了。
6.可以在收藏夹中显示出你的图标
<link rel=Bookmark href=favicon.ico>
说明:制作方法和上面的一样。只是显示的方式不同,这个是在别人收藏你的网页地址时显示的个性图标。
7.关闭输入法
<input style=ime-mode:disabled>
说明:这段代码是在表格提交时用到的。也就是在输入数据时不可以使用其他输入法模式。
8.永远都会带着框架
<script language=javascript><!--
 if (window == top)top.location.href = frames.htm;// --></script>
说明:frames.htm为你的网页,这也是保护页面的一种方法
9.防止被人frame
<SCRIPT LANGUAGE=javascript><!--
 if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
10.网页将不能被另存为
<noscript><iframe src=*.html></iframe></noscript>
说明:<noscirpt>的用法很广,其中一条就是可以使JS广告失效。
11.查源文件
<input type=button value=查看网页源代码
οnclick=window.location = 'view-source:'+  target=_blank>http://www.dingl.com ';>
12.COOKIE脚本记录,有很大的用处哦
function get_cookie(Name) {
var search = Name + =

 

var returnvalue = ;

 

if (documents.cookie.length > 0) {

 

offset = documents.cookie.indexOf(search)

 

if (offset != -1) { // if cookie exists

 

offset += search.length

 

// set index of beginning of value

 

end = documents.cookie.indexOf(;, offset);

 

// set index of end of cookie value

 

if (end == -1)

 

end = documents.cookie.length;

 

returnvalue=unescape(documents.cookie.substring(offset, end))

 

}

 

}

 

return returnvalue;

 

}

 


function loadpopup(){

 

if (get_cookie('popped')==''){

 

openpopup()

 

documents.cookie=popped=yes

 

}

 

}
说明:以上是JS代码,请自己加起始符和结束符

 


13.内框架<IFRAME>使用
Iframe标记的使用格式是:   
<iframe src=URL width=x height=x scrolling=[OPTION] frameborder=x
name=main></iframe>
src:文件的路径,既可是HTML文件,也可以是文本、ASP等  
width、height:内部框架区域的宽与高;   
scrolling:当SRC的指定的HTML文件在指定的区域不显不完时,滚动选项,如果设置为NO,则不出现滚动条;如为Auto:则自动出现滚动条;如为Yes,则显示;  FrameBorder:区域边框的宽度,为了让“内部框架“与邻近的内容相融合,常设置为0。
name:框架的名字,用来进行识别。
比如:  当你想用父框架控制内部框架时,可以使用: target=框架的名字来控制。

 

例子:<iframe name=mm src=http://www.dingl.com;; width=100% height=100% marginwidth=0 marginheight= ... ot; frameborder=0 scrolling=no></iframe>
14.自动跳转
在源代码中的<head>…</head>加入如下代码:
<meta http-equiv=refreshcontent=3;URL=http://www.dingl.com; charset=gb2312>
说明:content=3 表示3秒刷新到URL
15.如何改变链接的鼠标形状
只需在链接上加上这一代码就行的了
或者跟上面的用CSS写也行
style=cursor:hand       style=cursor:crosshair
style=cursor:text       style=cursor:wait
style=cursor:move       style=cursor:help
style=cursor:e-resize     
style=cursor:n-resize
style=cursor:nw-resize     style=cursor:w-resize
style=cursor:s-resize     
style=cursor:se-resize
style=cursor:sw-resize
以上代码你只需要加到连接或是页面的style区里就可以实现鼠标多样化。
16.全屏显示
<form>
<div align=center>
<input type=BUTTON name=FullScreen value=全屏显示 onClick=window.open(document.location, 'big', 'fullscreen=yes')>
</div>
</form>
把它放到<body>区中。
17.设为首页
<script language=javascript>
<!--
function defaul_home(){
this.home.style.behavior='url(#default#homepage)';this.home.setHomePage(' http://www.dingl.com /';
}
var focusok=false;
if (navigator.appName == Netscape{
focusok=true;
}
vers=navigator.appVersion;
if (navigator.appName == Microsoft Internet Explorer{
pos=vers.lastIndexOf('.');
vers=vers.substring(pos-1,vers.length);
}
proper_version=parseFloat(vers);

 

if(proper_version>=5){
focusok=true;
}
function launchstock1(htmlurl){
var stock=window.open(htmlurl,stock,top=2,left=2,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,
resizable=no,width=700,height=510;
if(focusok){
stock.focus();
}
return true;
}
function launchstock(){
var stock=window.open(,stock,top=2,left=2,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,

 

resizable=no,width=700,height=510;
if(focusok){
stock.focus();
}
return true;
}
// -->
</script>
<a href=# name=home onClick=defaul_home(); title===E代时光==>设为首页</a>
18.这里是加入收藏夹的代码
<a href=# onClick=window.external.addFavorite(' http://www.dingl.com
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值