javascript| Special Effects | Web pages |
Broadcast: A practical JS code fragment--Web page special effects code a lot, here to collect and collate some of the conventional more practical JS code snippets.
Font size Scaling
Make the text larger, so that more users see more clearly. (You can also change the font to a percentage)
<script type= "Text/javascript" >
function Dozoom (size)
{document.getElementById (' Zoom '). style.fontsize=size+ ' px ';}
</script>
<span id= "Zoom" > need to specify the size of the text </span>
<a href= "Javascript:dozoom" > Big </a> <a href= "Javascript:dozoom ()" > </a> <a href= " Javascript:dozoom () > Small </a>
Jump Menu New Window
<select name= "Select" >
<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>
Add to Favorites and set as Home page
Add to Favorites
<a href= "javascript:window.external.addFavorite (' http://link ', ' description ');" > Add to Favorites </a>
Set as homepage
<a href=# onclick=this.style.behavior= ' url (#default #homepage) '; this.sethomepage (' http://link ');> Set as homepage </a >
To open a window is to maximize
<script language= "JavaScript" >
<!--Begin
Self.moveto (0,0)
Self.resizeto (Screen.availwidth,screen.availheight)
End-->
</script>
Add background music
<bgsound src= "Mid/windblue[1].mid" loop= "-1" > only applies to IE
<embed src= "Music.mid" autostart= "true" loop= "true" hidden= "true" > for Netscape, IE all apply
Prevents clicking on the empty link, the page is often reset to the top end of the page
The code "javascript:void (NULL)" Instead of the original "#" tag, you can use the "#nogo" to replace AH?
Wrap Line
Style= "table-layout:fixed; Word-break:break-all; Word-wrap:break-word "
Only for IE useful ... FF words with Overflow:hidden to solve, not affect the beautiful