Each time alert is used to output information, the amount of information is small, and debugging is inconvenient. This method can better write js Code. Because Jquery is used more often, only the debugging method of Jquery is written, you can also add time before debugging information based on your preferences.
/**
* Print the JavaScript debugging information. Use absolute positioning to locate the location. Each printed message has a blank line.
*/
Function plInfo (obj ){
If ($ ("# show"). length = 0)
$ ("Body "). append ("<div id = \" show \ "style = \" position: fixed; left0px; top: 0px; width: 500px; line-height: 14px; font-size: 12px; color: #456; z-index: 200; \ "> debug info <br/> </div> ");
$ ("# Show"). append (obj + "<br/> ");
}
/**
* Print the JavaScript debugging information. Use absolute positioning to locate the position. The information printed each time is not empty and connected --
*/
Function plInfoNoBR (obj ){
If ($ ("# show"). length = 0)
$ ("Body "). append ("<div id = \" show \ "style = \" position: fixed; left0px; top: 0px; width: 500px; line-height: 14px; font-size: 12px; color: #456; z-index: 200; \ "> debug info <br/> </div> ");
$ ("# Show"). append (obj + "--");
}