Jump to content
Killersites Forums

JS equivalent of "Echo"??


Recommended Posts

Yes, the newbiest of questions, 'tis true, but what is the JS equivalent of PHP's "Echo" command? I know about using the Alert box, but that's not what I want. I just want a simple "Hello World" on the page, not as a pop up.


Now, I also know about document.write, too..BUT w3schools' page on this specifically says not to use it in "live" code because it could/would rewrite an entire page after loading.


Here's their blurb:


"Note: Try to avoid using document.write() in real life JavaScript code. The entire HTML page will be overwritten if document.write() is used inside a function, or after the page is loaded. However, document.write() is an easy way to demonstrate JavaScript output in a tutorial."


There has to be something simple that just echoes to the screen in javascript without causing other problems, no?


Note: This isn't one of those questions where I'm looking for people to ask "why do you even want JS to do that as there are better options?". It's just one of those "what's the equivalent" questions for my own knowledge. Thanks.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...