打印本文 打印本文 关闭窗口 关闭窗口
网页经典代码
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2906  更新时间:2007/10/28 12:53:30  文章录入:mintao  责任编辑:mintao

1.使网页不能被“另存为”
<body>里面加下面这段:
<noscript>
<iframe src="*.htm">
</iframe>
</noscript>

2.彻底屏蔽鼠标右键

<body>里面加上下面这段:
<script language="javascript">
<!--

if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
event.cancelBubble = true
event.returnvalue = false;

return false;
}

function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnvalue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>


3.超连接单元格变色

A:visited{TEXT-DECORATION: none}
A:active{TEXT-DECORATION: none}
A:hover{TEXT-DECORATION: underline overline}
A:link{text-decoration: none;}
表格单元,在单元格的<td>标记里加上:onMouseOut="this.style.backgroundColor='' "onMouseOver=this.style.backgroundColor='#E0E2ED'就可以了
onMouseOut="this.style.border='0px solid #cccccc';this.style.backgroundColor='' "onMouseOver="this.style.border='1px solid #cccccc';this.style.backgroundColor='#E0E2ED'"

4.细表格边框

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="158" height="68">
<tr>
<td width="158" height="68"> </td>
</tr>
</table>

5.网页全屏显示

把如下代码加入<body>区域中
<SCRIPT LANGUAGE="javascript">
<!-- Begin
if (this.name!='fullscreen'){
window.open(location.href,'fullscreen','fullscreen,scrollbars')
}
// End -->
</script>
<a href="javascript :window.close(self)">返回正常效果显示</a>


6.表格虚线

使用CSS,新建一个Style,选择“Redefine HTML Tag”,在下拉菜单中选择“td”,在弹出对话框中的“Category”里选择“Border”,将Top、Left、Right、Bottom都设成1px,颜色设成你想要的边框的颜色。然后在“Style”下拉框里选择“Dashed”,点“OK”。这样所有的表格都变成虚线的了。
或:
<table><td style="border:dashed 1px #00000">test</td></table>


7.连接全屏

<a href="#" onClick="window.open(URL,'','fullscreen=1')">Link</a>
通过连接可以打开一个全屏窗口

8.DW层的定位

用菜单插入层,不要用面板的。
主要就是不要设定层的left和right属性


9.css阴影滤镜

<div style="width:754;height:13;color:black;filter:dropshadow(color=white,offx=1,offy=1,positive=2);">  首页 关于本站 设计作品 </div>

<div style="width:75;height:1;color:black;filter:dropshadow(color=#cccccc,offx=1,offy=1,positive=2);" align="center"><font color="#414992"><a href="index.htm">首页</a></font></div>


10.关闭窗口

<a href="javascript :closewin();">关闭本页</a>
<script language=javascript>
function closewin() {window.close(); return;}
</script>


1.图层的准确定位

在单元格里Insert/Layer,插入一个图层A(通过菜单插入的图层是相对定位),他的位置是跟着参照物改变的。接着图层A中插入一个图层B。这时你可移动图层B到任何位置。这时图层B的位置是绝对的,但这个绝对植的起点不是浏览器的左上角。而是图层A。


1.自动连接到另一页

<meta http-equiv="refresh" content="5;URL=index.htm">


2.虚线表格

<title>虚线</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.unnamed1 { border: #000000; border-style: dotted; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">

<table width="289" border="0" cellpadding="0" cellspacing="0" class="unnamed1">
<tr>
<td width="289" height="220"></td>
</tr>
</table>
</body>


3.不同分辨率返回不同页面

<script language="javascript">
<!-- Begin
if ((screen.width == 640) && (screen.height == 480)){
self.location.href='640*480.htm'
}
else if ((screen.width == 800) && (screen.height == 600)){
self.location.href='800*600.htm'
}
else if ((screen.width == 1024) && (screen.height == 768)){
self.location.href='1024*768.htm'
}
else {self.location.href='else.htm'
}
// End -->
</script>


4.显示日期

<script language="javascript"><!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
// -->
</script>

5.表格一行多个
在table里加style="float:left"

27> 如何自动加入网页更改后的日期?
只需要在源文件<body></body>之间添加如下代码即可。

< Script Language=“JavaScript”><!--
document.write(“Last Updated:”+document.lastModified);
-->< /Script>

鼠标感应渐显图片代码
<script language="javascript1.2">
function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=20
}
</script>
<img src="tp1.gif" style="filter:alpha(opacity=20)" onMouseOver="makevisible(this,0)" onMouseOut="makevisible(this,1)">

(((<!--tp1.gif为图片源-->
<!--opacity数值可自定-->

cur.filters.alpha.opacity=100


cur.filters.alpha.opacity=20

两个数值分别用来控制图片在两种状态下的透明度。)))

插入单根虚线水平线
<hr style="border:dashed #0099cc; width:1px; height:300px">
<hr size="1" noshade style="border:none #cc9900; width:100%; height:1">
<hr size="1" noshade style="color:#ffccee; width:100%; height:1">

插入单根虚线水平线2
<p size=1 style="border:1px dotted #001403;">

如果要使Flash动画背景透明,我们需要在Dreamweaver中对动画进行设置:

  1.在DW中插入一个Flash动画,在对象属性栏中点击参数(Parameters)按钮;
  2、在参数设定对话框中,点击加号新建一参数,左边参数项填入Wmode,右边参数值填入Transparent;

  这样,用浏览器打开保存好的页面时,你就会发现Flash动画的背景已经变为透明。

  反映到HTML代码上,即是在插入Flash的<OBJECT>标签中插入以下代码:<param name=″Wmode″ value=″transparent″>

按纽,输入框等更改背景和线框颜色
在<input 后加入以下代码
class="purchase(为文字定义颜色的css名)" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #993300"

表单里的文本框有提示文字,鼠标移上去就消失
在<input name="textfield1" 后加入onFocus="this.value=''"

改变文字,单元格所引用的css样式
<td onMouseOver="this.className='要变化的css名不要点号';"

半透明图片,鼠标移上去就完全显现
<img class="low" onMouseOver="this.className='high'"; onMouseOut="this.className='low'">
low为css设置好的半透明,high为css中设置好的完全显示

改变图片/按纽/文字的其他属性---以图片为例
<img src="img1" onMouseOver="this.src='img2'" onMouseOut="this.src='img1'">
如果改变图片的大小就将this.src改成this.width或者this.height

插入一个左上角带标题的表格
<fieldset style="width:220" align="center">
<legend>这里是表格的标题</legend>
这里添加表格中的内容
</fieldset>

表格可以带滚动条
在<td>与</td>中加入<div style="overflow:auto;height:160;">
这里输入文段的内容。
</div>

非常酷的黑色立体滚动条
<STYLE type="text/css">
<!--BODY {
scrollbar-face-color:#424542;
scrollbar-arrow-color:#CECFCE;
scrollbar-highlight-color:#636563;
scrollbar-3dlight-color:#000000;
scrollbar-shadow-color:#424542;
scrollbar-darkshadow-color:#000000;
scrollbar-track-color:#101010;
}--></STYLE>
放在<head>与</head>之间

进入页面需要密码。三次错误则退出[放在<body>与</body>之间]

<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('桔子私人资料请输入密码','');

[1] [2]  下一页

打印本文 打印本文 关闭窗口 关闭窗口