Buttons are inevitably used in web page production. This article lists some commonly used button codes.
View source code
The following is a quoted snippet:
<input TYPE="button" NAME="view" VALUE="View source code" OnClick="window.location='view-source:' +window.location.href" >
Return to the previous step
The following is a quote fragment:
<input TYPE="button" VALUE="Back to previous step" ONCLICK="history.back(-1)">
Refresh button -
The following is a quote snippet:
<input TYPE="button" VALUE="Refresh button one" ONCLICK="ReloadButton()">
<script language="JavaScript">
<!--
function ReloadButton(){location.href="3.html";}
// -->
</script>
Refresh button two
The following is a quote snippet:
<p>
<input TYPE="button" VALUE="Refresh button two" onClick="history.go(0)">
Back to Home Button
The following is a quote:
<input TYPE="button" VALUE="Home Button" ONCLICK="HomeButton()">
<script language="JavaScript">
<!--
function HomeButton(){location.href=http://www.aaa.com;}
// -->
</script>
A warning box pops up.
The following is a quote:
<input TYPE="button" VALUE="Pop-up warning box" ONCLICK="AlertButton()">
<script language="JavaScript">
<!--
function AlertButton(){window.alert("Have you drunk today? :)");}
// -->
</script>
The status bar information
is quoted below:
<p>
<input TYPE="button" VALUE="Status bar information" ONCLICK="StatusButton()">
<script language="JavaScript">
<!--
function StatusButton(){window.status="How are you?:)";}
// -->
</script>
Background color transformation
The following is a quoted snippet:
<input TYPE="button" VALUE="Background color change" onClick="BgButton()">
<script language="JavaScript">
<!--
function BgButton(){
if (document.bgColor=='#3399ff')
{document.bgColor='#00ccff';}
else{document.bgColor='#3399ff';}
}
// -->
</script>
Open a new window
The following is a quote:
<input TYPE="button" VALUE="Open new window" ONCLICK="NewWindow()">
<script language="JavaScript">
<!--
function NewWindow(){window.open( http://www.aaa.com,"","height=600,width=800,left=10,top=10,status=no,location=no,toolbar=no , directories=no,menubar=no");}
// -->
</script>