sketchucation logo sketchucation
    • Login
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Document.write() cover function

    scheduled pinned locked moved Developers' Forum
    1 Posts 1 Posters 113 Views 1 Watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • M Offline
      MartinRinehart
      last edited by

      I originally wrote dw() as a typist-friendly synonym for document.write(). Then I had it write text to an alert() box if "debug" was set true. It got improved to the following when I found that none of my browsers could manage a scrollbar for an over-length alert() box. (Beer license: if this helps you and we happen to meet, first round is on you.)

      function dw( text ) {
      	if ( debug ) { // in your old line editor; rep /</&lt;/g 
      		document.write( text.replace(new RegExp( '<', 'g' ), '&lt;') + '<br>' );
      	} else {
      		document.write( text );
      	}
      }
      
      

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      one-reply-to-this-post last-reply-time reply quote 0
      • 1 / 1
      • first-post
        last-post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement