天天看点

html常用小技巧

加入收藏代码:

<a href="javascript:void(0)" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" οnclick="AddFavorite(window.location,document.title)">加入收藏</a>

设为首页代码:

<a href="javascript:void(0)" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" οnclick="SetHome(this,window.location)">设为首页</a>

用图片做按钮

 <input type="button" name="Submit2" value="" alt="搜索" style="vertical-align:middle; background-image:url(../images/btn_search2.gif);border:0px; width:46px; height:20px" onClick="SubmitPro1(this.form);"/>

改变IE地址栏的IE图标

要先做一个16*16的icon(图标文件),保存为index.ico。把这个图标文件上传到根目录下并在首页<head></head> 

之间加上如下代码: <link REL = "Shortcut Icon" href="/index.ico" target="_blank" rel="external nofollow" >

不要滚动条 

让竖条没有: <body style='overflow:scroll;overflow-y:hidden'> </body>

让横条没有: <body style='overflow:scroll;overflow-x:hidden'> </body>

两个都去掉: <body scroll="no"> </body>

放上去鼠标变成小手的代码:style="cursor: hand"

文本区域框英文自动换行代码:style="word-break:break-all"

如内容超出单元格,则隐藏:style="TABLE-LAYOUT: fixed"

让弹出窗口总是在最上面: <body οnblur="this.focus();">

下拉菜单自动跳转代码:

<select onChange="javascript:window.open(this.options[this.selectedIndex].value)" >

给TD加边框:

文本竖排方式

<style type="text/css">

<!--

.shupai {Writing-mode:tb-rl}

-->

</style>

超链接去虚线边框:在链接中加上οnfοcus="this.blur()"

style="border-left:1px #0D73D8 solid;border-top:1px #0D73D8 solid; border-right:1px #0D73D8 solid;border-bottom:1px #0D73D8 solid;"

给TD加距离

 style="padding-left:3px;padding-top:3px;padding-right:3px;padding-bootum:3px;"

去掉图片链接点击后周围的虚线: <a href="#" target="_blank" rel="external nofollow" onFocus="this.blur()"><img src="logo.jpg" border=0></a>

JS 打印

<a href="javascript:window.print();" target="_blank" rel="external nofollow" ></a>

JS 关闭窗口

<a href="javascript:window.close();" target="_blank" rel="external nofollow" ></a>

继续阅读