View Source

This Script lets you have a button that when pressed will view the source of the document.

Copy the following into the <HEAD> section

<script type="text/javascript">
<!--
function viewSource() {
window.location = "view-source:"+window.location;
}
//-->
</script>

Copy the following where you want the button to go.

<form>
<input type="button" value="View Source" onClick="JavaScript:viewSource()">
</form>


You can use the following without the script:

<INPUT type=button value="View Source 2" onclick="window.location =' view-source:' + window.location;">


The following uses a standard link:

<A HREF="#null" onclick="window.location =' view-source:' + window.location; return false">View Source 3</A>

View Source 3


To view the source of a frame from another frame

<A HREF="#null" onclick="window.location =' view-source:' + parent.framename.location; return false">View Source</A>

framename is the name of the frame that contains the source to be viewed.