/    Sign up×
Community /Pin to ProfileBookmark

Making a new line

I’m trying to insert a newline escape character into my script.. but it seems to insert a space rather than make a new line. Am I doing something wrong?

[CODE]<html>
<script type=”text/javascript”>
var name = “Joe Nobody”;
var gpa = 0;
hoursWorked = prompt(“Enter your name”,”Joe Nobody”);
gpa = prompt(“Enter your GPA”,0);
document.write(“Hello “, name, “. Your GPA is “, gpa);
document.write(“nMake a new line.”);
</script>
</html>[/CODE]

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@kwiknessauthorOct 13.2006 — Also.. why is the script giving me a security warning? (ActiveX)
Copy linkTweet thisAlerts:
@flpnmOct 13.2006 — Hi

look, you can't make at this way ?

<script>

function writeMyName(obj)

{

document.getElementById('myName').innerHTML = obj.value

}

</script>

<body>

<input type="text" id="nome" onblur="writeMyName(this)">

<br>

<div id="myName">

</div>

</body>


well, i dont test it, bat, when you get out of input (onblur) it will to write the input value into the div

PS. i'm sorry, about may bad inglish, i am brasiliam, but i am many times in this site, looking for cool informations ...
Copy linkTweet thisAlerts:
@CharlesOct 13.2006 — Use:[code=html] <pre><script type="text/javascript">
var name = "Joe Nobody";
var gpa = 0;
hoursWorked = prompt("Enter your name","Joe Nobody");
gpa = prompt("Enter your GPA",0);
document.write("Hello ", name, ". Your GPA is ", gpa);
document.write("nMake a new line.");
</script></pre> [/code]
or even[code=html]<pre><script type="text/javascript">
var name = "Joe Nobody";
var gpa = 0;
hoursWorked = prompt("Enter your name","Joe Nobody");
gpa = prompt("Enter your GPA",0);
document.writeln("Hello ", name, ". Your GPA is ", gpa);
document.writeln("Make a new line.");
</script></pre> [/code]
Copy linkTweet thisAlerts:
@kwiknessauthorOct 13.2006 — writeln! Thats what I was looking for! Thanks a bunch! Just out of curiosity what are the "pre" tags for? Seems thats all I needed to add.
Copy linkTweet thisAlerts:
@CharlesOct 13.2006 — Try it with and without.
×

Success!

Help @kwikness 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.18,
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,
)...