Home >Development Tools >dreamweaver >Summary of commonly used codes in Dreamweaver

Summary of commonly used codes in Dreamweaver

不言
不言forward
2018-09-29 14:48:068841browse

This article brings you a summary of commonly used codes in Dreamweaver. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Dreamweaver commonly used codes:

1. Control the display and concealment of horizontal and vertical scroll bars?

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

2. The table changes color

<TD onmouseover="this.style.backgroundColor=&#39;#FFFFFF&#39;" 
onmouseout="this.style.backgroundColor=&#39;&#39;"
style="CURSOR: hand">

3. Copying is prohibited, drag the mouse to select

<body ondragstart=window.event.returnValue=false oncontextmenu=window.event.returnValue=false onselectstart=event.returnValue=false>

4. Ordinary iframe page

<iframe name="name" src="main.htm" width="450" height="287" scrolling="Auto" frameborder="0"></iframe>

5. iframe adaptive height

<iframe name="pindex" src="index.asp" frameborder=false scrolling="auto" width="100%" height="100%" frameborder=no onload="document.all[&#39;pindex&#39;].style.height=pindex.document.body.scrollHeight"></iframe>

6. Change the IE address bar to your own icon & your icon can be displayed in your favorites

<link rel="Shortcut Icon" href="favicon.ico">
<link rel="Bookmark" href="favicon.ico">

7. Font size scaling

More and more people spend a lot of time online, and the popularity of glasses is also getting higher and higher. Make the text larger so that more users can read it. More clearly.

<script type="text/javascript">
function doZoom(size)
{document.getElementById(&#39;zoom&#39;).style.fontSize=size+&#39;px&#39;;}
</script>
<span id="zoom">需要指定大小的文字</span>
<a href="javascript:doZoom(16)">大</a> 
<a href="javascript:doZoom(14)">中</a> 
<a href="javascript:doZoom(12)">小</a>

8. Simple jump web page code

If you want the page to jump after being displayed for 3 seconds, you can add the 93f0f5c25f18dab9d176bd4f6de5d30e< in the html code Add this code to the ;/head> part:

<meta http-equiv="refresh" content="3; url=//m.sbmmt.com">

9.iframe (embedded frame) adaptive height

The embedded address filled in must be in the same page as this page site, otherwise it will prompt "Access Denied!". There are permission issues with cross-domain references, please check other information.

<iframe name="guestbook" src="gbook/index.asp" scrolling=no width="100%" height="100%" frameborder=no onload="document.all[&#39;guestbook&#39;].style.height=guestbook.document.body.scrollHeight"></iframe>

10. Jump menu new window

<select name="select" onchange="window.open(this.options[this.selectedIndex].value)">
<option value="http://www.microsoft.com/ie"> Internet Explorer</option>
<option value="http://www.microsoft.com"> Microsoft Home</option>
<option value="http://msdn.microsoft.com"> Developer Network</option>
</select>

11.flash transparent option

<param name="wmode" value="transparent">

12.Add to favorites and settings For the home page

<a href=# onclick="this.style.behavior=&#39;url(#default#homepage)&#39;;this.setHomePage(&#39;设为首页" _href="//m.sbmmt.com/&#39;);">设为首页</a> 
<a href="javascript:window.external.AddFavorite(&#39;//m.sbmmt.com/&#39;,&#39;php中文网&#39;)">收藏本站</a>
13. Record and display the last modification time of the web page
<script language=JavaScript> 
document.write("最后更新时间: " + document.lastModified + "") 
</script>

14. Holiday countdown

<Script Language="JavaScript"> 
   var timedate= new Date("October 1,2002"); 
   var times= "国庆节"; 
   var now = new Date(); 
   var date = timedate.getTime() - now.getTime(); 
   var time = Math.floor(date / (1000 * 60 * 60 * 24)); 
   if (time >= 0) 
   document.write( "现在离"+times+"还有: "+time +"天")
</Script>
15. Add to HEAD
Disable caching
<meta http-equiv="Expires" CONTENT="0"> 
<meta http-equiv="Cache-Control" CONTENT="no-cache"> 
<meta http-equiv="Pragma" CONTENT="no-cache">
16. Let IFRAME The background of the document within the frame is transparent
<iframe src="about:<body style=&#39;background:transparent&#39;>" allowtransparency></iframe>17.打开窗口即最大化
<script language="JavaScript"> 
<!-- Begin 
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
// End --> 
</script>
18. Add background music
<bgsound src="mid/windblue[1].mid" loop="-1"> 只适用于IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 对Netscape ,IE 都适用
19. Scroll
<marquee direction=up height=146 onmouseout=start() onmouseover=stop() scrollAmount=2>滚动信息</marquee>

20. Prevent the page from being reset to the top of the page when clicking on an empty link

The code "javascript:void(null)" replaces the original "#" mark

21. Text or pictures pop up a window of a specified size

Add

<script language="JavaScript" type="text/JavaScript">
function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features);}
</script>
# to the body ##Pop-up code

<a href="#" target="_self" onClick="MM_openBrWindow(&#39;windows01.htm&#39;,&#39;&#39;,&#39;width=550,height=380&#39;)" width="550" height="380" border="0">图片或文字</a>
22. Jump page code
<meta http-equiv="refresh" content="5;url=//m.sbmmt.com/">

23. Thin line separator

<hr noshade size=0 color=#C0C0C0>

24. Automatic line wrapping in the web page

<td style="word-break:break-all">
is done. The complete thing is
style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word"

25. Eliminate the image toolbar that automatically appears in ie6 and set the GALLERYIMG attribute to false or no.

09d53e95f3ba19cc77803f7d7ee3962c

26. Prevent the page text from being selected

<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()">
27. Cannot right-click, use CTRL A, and cannot copy!

<body oncontextmenu="window.event.returnValue=false" 
onkeypress="window.event.returnValue=false" 
onkeydown="window.event.returnValue=false" 
onkeyup="window.event.returnValue=false" 
ondragstart="window.event.returnValue=false" 
onselectstart="event.returnValue=false"> 
</body>

28.IE The browser supports a Body property bgproperties, which can prevent the background from scrolling:

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

29. Randomly transform the background image (a special effect that can refresh the mood)

<Script Language="JavaScript"> 
   image = new Array(4); //定义image为图片数量的数组 
   image [0] = &#39;tu0.gif&#39; //背景图象的路径 
   image [1] = &#39;tu1.gif&#39; 
   image [2] = &#39;tu2.gif&#39; 
   image [3] = &#39;tu3.gif&#39; 
   image [4] = &#39;tu4.gif&#39; 
   number = Math.floor(Math.random() * image.length); 
   document.write("<BODY BACKGROUND="+image[number]+">"); 
</Script>
30. Picture form button

<form id="form1" name="form1" method="post" action="">
<img src="login.gif" width="62" height="22" onclick="document.form1.submit()" />
</form>

31. CSS definition method of left and right shadow background

body {
text-align:center;
background-repeat: repeat-y;
background-position: center;
background-image: url(../images/bg.jpg);
}

32. Move the hand mouse over the link

style="cursor:hand"

33. How to close the layer

<div id="Layer1"></div>
<a href="#" onClick="Layer1.style.display=&#39;none&#39;">关闭层</a>

34. Close the window Script


<a href=javascript:close()>[关闭窗口]</a>

35. If the text is too long, the long part will be turned into an ellipsis and displayed


<DIV STYLE="width: 120px; height: 50px; border: 1px solid blue;overflow: hidden; text-overflow:ellipsis"> 
<NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR> 
</DIV>

36. Automatically maximize after entering the homepage


<script> 
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
</script>

37. Dented text


<div style="width:300px;padding:20px;overflow:hidden;word-wrap:break-word;word-break:break:all; font-size:12px; line-height:18px; background-color:#eeeeee;"><font disabled>

How about it, am I dented? 0c6dc11e160d3b678d68754cc175188a

Don’t you want to try it? 0c6dc11e160d3b678d68754cc175188a

<a href="http://www.lenvo.cn/">www.lenvo.cn</a></font>
</div>

38. Run the code box


<script>
function Preview()
{var TestWin=open(&#39;&#39;);
TestWin.document.write(code.value);}
</script>
<textarea id=code cols=60 rows=15></textarea>
<br>
<button onclick=Preview() >运行</button>

39. Link the table


<table width="100%" onclick="window.open(&#39;http://www.makewing.com/&#39;, &#39;_blank&#39;)" style="CURSOR:hand">
<tr>
<td height="100" bgcolor="f4f4f4"> </td>
</tr>
</table>

40. Let the pop-up window Always on top

c254b25e31c1c45e63c0c797894ac82f

41.CSS text shadow


.shadowfont{FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋体"; FONT-SIZE: 9pt;COLOR: #ffffff;}

42.Back &Close window

Back: javascript:history.back(1)
Close: javascript:window.close();

43. The table is transparent


style="FILTER: alpha(opacity=72)"

44. How to prevent others from putting your web page in a frame


<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>

45. The difference between Alt and Title


alt is used to give hints to pictures. Title is used to give link text or ordinary text hints.


<a href="#" Title="给链接文字提示">文字</a>
<p Title="给链接文字提示">文字</p>
<img src="图片链接" alt="给图片提示">

46. Try to use external calls for all javascript calls


<SCRIPT LANGUAGE="javascript" SRC="js/xxxxx.js"></SCRIPT>

47. Link to


response.redirect"login.asp"location.href="xx.asp"onClick="window.location=&#39;login.asp&#39;"onClick="window.open(&#39;&#39;)"

48. Basic link style

a:link represents the style of the link

a:active represents the style of the currently active connection
a:hover represents the style when the mouse moves over
a:visited represents the visited connection Style

"link-visited-hover-active" is abbreviated as "lvha", which is "love" "hate"

49. Set styles with different text link effects on the same page


<style type="text/css">
.green {COLOR: #309633}
.green A:link {COLOR: #309633; TEXT-DECORATION: none}
.green A:visited {COLOR: #309633; TEXT-DECORATION: none}
.green A:hover {COLOR: #309633; TEXT-DECORATION: underline}
.green A:active {COLOR: #309633; TEXT-DECORATION: none}
</style>
<a href="#" class="green">文字</a>

50. Drop-down jump menu


<select name=select onchange="javascript:window.open(this.options[this.selectedIndex].value)"style="color:#333">
<option>----请选择----</option>
<option value="http://www.webkkk.com">站长设计网</option>
<option value="http://www.makewing.com/store/">MakeWing Store</option>
<option value="http://www.izhu.com/">爱烛网</option>
</select>

51.Select the solution to blocking the div

Add the following code to the div and adjust it as needed.

<iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; top:5px; left:2px;width:168;height:100px;"></iframe>

52. All links on the entire page are _blank New window opens


<base target="_blank">

The above is the detailed content of Summary of commonly used codes in Dreamweaver. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete