Common JavaScript code (4): javascript code
The article is from "PHP100 Chinese network"
18. Change the button image.
<Style type = "text/css">
<! --
. Style3 {font-size: 12px; background: url (image/buttonbg1.gif); border: 0px; width: 60px; height: 22px}
. Style4 {font-size: 12px; font-weight: bold; background: url (image/buttonbg2.gif); border: 0px 0; width:
60px; height: 22px}
-->
</Style>
In this example, the button code is as follows:
<Input type = "submit" name = "Submit2" value = "submit" onmouseover = "this. className = 'style4 '"
Onmouseout = "this. className = 'style3'" class = "style3">
19. Print the page
<Div align = "center"> <a class = content href = "javascript: doPrint ();"> Print this article </a> </div>
20. You can directly write the html language.
Document. write ("");
21. change the color of the drop-down box.
<Select name = "classid"
OnChange = "changelocation (document. myform. classid. options [document. myform. classid. selectedIndex]. value )"
Size = "1" style = "color: #008080; font-size: 9pt">
22. Go to the target URL
Window. location = "http: // guoguo"
23. Pass the form of the object
UpdateSN ('guoqiang99267', this. form)
Function UpdateSN (strValue, strForm)
{
StrForm. SignInName. value = strValue;
Return false;
}
24. Text labels
<Label for = "AltName4"> <input name = "AltName" type = "RADIO" tabindex = "931" id = "AltName4"
> Guoqiang99859 </label>
25. layer2 is the component ID, which controls whether the component is visible.
Document. all. item ('layer2'). style. display = "block ";
Document. all. item ('layer2'). style. display = "none ";//
26. Add the page to favorite
<Script language = javascript>
<! --
Function Addme (){
Url = "http://your.site.address"; // your own home address
Title = "Your Site Name"; // Your own homepage Name
Window. external. AddFavorite (url, title );
-->
</Script> //
27. automatically close the page in 10 seconds
<Script language = "JavaScript">
Function closeit (){
SetTimeout ("self. close ()", 10000)
}
</Script>