RSS

Javascript Event Log ~ Console

15 Apr

This is the javascript function used for tracking javascript events as in alert(). This may be replacement of alert() to better track the javascript events and error/success messages.


/*
Below is the function where to call console()
*/
window.document.onclick = function(){ console(window.event.target.onclick) }; 

function console(msg)
{

	mywin = window.open('', 'console', 'width=500,height=150,left=800,top=800,scrollbars=yes,location=no');
	
	if (mywin && msg!=null)
	  mywin.focus();	
	
	mywin.document.title='Javascript Console...';
	//mywin.document.writeln('<h4>Javascript Log here..</h4>');
	if(msg!=null)
	mywin.document.writeln('<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; border-bottom: 1px dotted #FFB64A; padding:4px;">'+msg+'</div>');
	
	//mywin.document.writeln("<br /><a href=\"javascript:void(0)\" onclick=\"this.document.write='';\" >Clear</a>");
	
	//sleep(10); mywin.blur();
	
}

Advertisements
 
Leave a comment

Posted by on April 15, 2009 in 1, Ajax, javascript

 

Tags: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: