Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts

    documen.write problem

    Ok, I went here:

    http://www.simonsgroup.com/test/html...avascript.html

    and put some coding in to be converted, and it gave me some stuff I don't understand:


    var code="javascript here";

    I have always used document.write('stuff here'); for my external JS files. What is the difference?

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    nothing.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basically all that script is doing for you is converting your HTML or text string into a javascript variable, and then using document.write() to write it out for you.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Whammy is 100% right.

    Example

    you normally put (as you said)

    say : document.write("<html><head><title>DD</title></head>")

    all there doing is putting the <html><head> ect. into a javascript variable

    like: var code="<html><head><title>DD</title></head>"

    then there putting it into the document.write

    as: document.write(code)

    by doing that you can cut down on space & its alot neater.
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •