Console Messages

[Total: 0    Average: 0/5]

This shows how to open up a “Console” window and send messages to it.

Head Code:

<script type="text/javascript">
var _console=null
var n=0
function debug(msg) {
  if ((_console==null) || (_console.closed)) {
    _console=window.open("","console","width=600,height=300,resizable")
	_console.document.open("text/plain")
  }
  _console.document.writeln(msg)
}
function clearCount() {
  n=0;
  if (!_console.closed) _console.document.write("--------- RESET COUNTER ---------n")
}
function clearConsole() {
  _console.document.close()
  _console.document.open("text/plain")
  _console.document.writeln(" ")
}
</script>

Body Code:

<form>
  <input type="button" value="Push Me" onClick="debug('You have pushed me:t'+ ++n + ' times.')">
  <input type="button" value="Clear Count" onClick="clearCount()">
  <input type="button" value="Clear Console" onClick="clearConsole()">
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *