Miscellaneous
JavaScript Code for You


Status Bar display for a Link
Back Button
Link used to go Back
Browser Type and Version
JavaScript Version
JavaScript Enabled
document.write()
A more complex document.write()
Alert Dialog Box
Pop-up Alert on Mouse-over
Pop-up Window on Mouse-over
Close Button
View Source Button
View Source Link
Click on any green divider line to return here.

 

Status Bar display for a Link

Demo to illustrate setStatus() function.
Move mouse over this link
Observe status bar.


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  function setStatus(msg){
    status = msg
    return true
    }
//-->
</SCRIPT>


<P>Demo to illustrate setStatus() function.<BR>
<A HREF="" onMouseOver="return setStatus('Your mouse is now over link')" 
           onMouseOut="return setStatus('')">Move mouse over this link</A>
<BR>Observe status bar.

 

Back Button


<FORM>
<INPUT TYPE="button" VALUE="Back" onClick="history.back()">
</FORM>

 

Link used to go Back

Demo illustrating how to use a link to go back.
Back


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  function setStatus(msg){
    status = msg
    return true
    }
//-->
</SCRIPT>


<P>Demo illustrating how to use a link to go back.<BR>
<A HREF="JavaScript:history.back()" 
           onMouseOver="return setStatus('Back')"
           onMouseOut="return setStatus('')">Back</A>

 

Browser Type and Version

Demo illustrating how to determine Browser type and version.


<P>Demo illustrating how to determine Browser type and version.<BR>
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  document.write("<B>Browser: " + navigator.appName + "</B><BR>");
  document.write("<B>Version: " + navigator.appVersion + "</B>");
//-->
</SCRIPT>

 

JavaScript Version

Demo illustrating how to determine JavaScript version.


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  function JSVer(){
    return "1.0"
    }
//-->
</SCRIPT>
<SCRIPT Language="JavaScript1.1">
<!-- hide from old browsers
  function JSVer(){
    return "1.1"
    }
//-->
</SCRIPT>
<SCRIPT Language="JavaScript1.2">
<!-- hide from old browsers
  function JSVer(){
    return "1.2"
    }
//-->
</SCRIPT>
<SCRIPT Language="JavaScript1.3">
<!-- hide from old browsers
  function JSVer(){
    return "1.3"
    }
//-->
</SCRIPT>


<P>Demo illustrating how to determine JavaScript version.<BR>
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  document.write("<B>Your browser supports JavaScript version " + JSVer() + "</B>")
//-->
</SCRIPT>

 

JavaScript Enabled


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  document.write("<Font color='green'>Good, you are JavaScript enabled!</FONT>")
//-->
</SCRIPT>
<NOSCRIPT>
  <FONT color="red">Sorry, you are <B>not</B> JavaScript enabled.
</NOSCRIPT>

 

document.write()


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  document.write("This was put in this page using the document.write() method.")
//-->
</SCRIPT>

 

A more complex document.write()


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var msg = "document.write() is one of the most useful JavaScript methods.<BR>"
   + "This information was first put in a variable and then written to this page<BR>"
   + " using document.write(msg). You will find many uses for this technique."

  document.write(msg)
//-->
</SCRIPT>

 

Alert Dialog Box


<FORM>
<INPUT type="button" value="Alert Demo" 
onClick='alert("Put your text here!")'>
</FORM>

 

Pop-up Alert on Mouse-over

Move mouse over this


<A href="" onMouseOver='alert("Put your text here!")'>
Move mouse over this</A>

 

Pop-up Window on Mouse-over

Move mouse over this


<A href="" onMouseOver='window.open("popdemo.htm","demo","width=260,height=200")'>
Move mouse over this</A> 

 

Close Button

See previous script, "Pop-up Window on Mouse-over",  for a demo.


<CENTER><FORM>
<INPUT type="Button" VALUE="Close" onClick="self.close()">
</FORM></CENTER>

 

View Source Button


<INPUT type="Button" value="View Source" onClick='window.location="view-source:"+window.location.href'> </FORM>

 

View Source Link

View Source


<A href='JavaScript:window.location="view-source:"+window.location.href'>
View Source</a> 





Menus     Advanced