/    Sign up×
Community /Pin to ProfileBookmark

document.write VS. document.writeIn

Before I upload my page to a server I was thinking of all the troubles ahead for that action. It would be nice if I knew what I was doing and could have the page ready to go before upload but….
One item I was thinking about is “document.writIn.” I’m not sure but, I think I should replace all my “document.write” with the other because it will be server side?
What is the deal and difference between those two?

Also, what’s the dif between “setTimeout” and “setInterval?”

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Feb 27.2006 — writeln adds a line break

timeout fires once, interval fires on an interval.

You can find this in any JavaScript book or online reference.

Eric
Copy linkTweet thisAlerts:
@UltimaterFeb 27.2006 — document.writeIn isn't a function, the proper function is called document.writeln. It's a lowercase "L" not a capital "i" pronounced "write line".

document.writeln(something)

is the same thing as:

document.write(something+"n") //Might have been rn, I forget, either way it's a linebreak

To really see the difference, test it out with the PRE tag:

<i>
</i>&lt;pre&gt;
&lt;script type="text/javascript"&gt;
document.writeln("line1");
document.writeln("line2");
document.writeln("line3");
document.writeln("line4");
&lt;/script&gt;
&lt;/pre&gt;

Versus:
<i>
</i>&lt;pre&gt;
&lt;script type="text/javascript"&gt;
document.write("line1");
document.write("line2");
document.write("line3");
document.write("line4");
&lt;/script&gt;
&lt;/pre&gt;



Instead of writeln you can also use:
<i>
</i>&lt;pre&gt;
&lt;script type="text/javascript"&gt;
document.write("line1n");
document.write("line2n");
document.write("line3n");
document.write("line4n");
&lt;/script&gt;
&lt;/pre&gt;
×

Success!

Help @jzwp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...