Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:49:41+00:00 2026-05-11T14:49:41+00:00

I’d like to find a better way to output console messages to an HTML

  • 0

I’d like to find a better way to output console messages to an HTML page. This method seems to be pretty slow.

<html> <title>Logging test</title> <head> <SCRIPT LANGUAGE='JavaScript' TYPE='text/javascript'> <!--  function log(s) {     if(!log.start) {         var date = new Date();         log.count = 0;         _log('0', 'log() started at ' + date);         log.start = date.valueOf();     }     _log(new Date().valueOf() - log.start, s); }  function _log(header, s) {     var logMessages = document.getElementById('logMessages');     if(!logMessages) {         alert(logMessages);         return;     }     var message = document.createElement('div');     message.className = 'logMessage';     var content = '';     content += '<span class=\'time\'>' + header + '</span>';     content += '<span class=\'line\'>' + (log.count++) + '</span>';     content += '<span class=\'level\'>' + '' + '</span>';     content += '<span class=\'msg\'>' + s.replace(/ /g, '&nbsp;').replace(/\n/g, '<BR />') + '</span>';     message.innerHTML = content;     logMessages.appendChild(message);     setTimeout(function(){message.scrollIntoView(true)},1); }  function main(e) {     if(window.confirm('Would you like to display logging?')) {         for(var i=0;i<5000;i++) {             log('Hello World ' + i);         }     } } //--> </SCRIPT>  <style> .logMessage {     border-bottom: 1px black solid;     font-size: 8pt;     font-family: Lucida Console; }  .logMessage .line, .logMessage .time {     width: 30px; }  .logMessage .level {     display: none; }  .logMessage .msg { }  #logMessages {     overflow: auto; } </style>  </head> <body onload='main()'> <div id='logMessages'></div> </body>  </html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:49:42+00:00Added an answer on May 11, 2026 at 2:49 pm

    What’s the use case here? For debugging, Firebug’s console.log is all I can ever imagine needing. For your specific case, if you really want it to go to on the page and find your current solution to be too slow, I would definitely replace all the string concatenations with something a little more efficient (pushing strings into an array and joining them at the end, or a StringBuffer that abstracts it out), as string manipulation in Javascript is infamously bad in some browsers (I’m looking at you, Redmond!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.