Jump to content

escape sequence


robokopf

Recommended Posts

hi guys, i'm just starting on javascript and i've got a question about escape sequence and using them together with the document.write. here's a sample code that i have

document.writeln('<font size=3 face=verdana>'+name+'</font>');document.writeln('<font size=3 face=verdana>'+age+'</font>');

i was wondering how to i add in the \n - new line escape sequence? thanks in advance :)

Link to comment
Share on other sites

I don't think it's possible to use \n within a document.writeIn, probably because you are writing html to the page and \n is not markup language. To create a new line use the <br /> tag.document.writeln('<font size=3 face=verdana>'+name+'</font><br />');document.writeln('<font size=3 face=verdana>'+age+'</font>');You can use \n for things like alert messages, this would insert a new line:alert("I am on \ntwo lines");<font> tag is out of date - check out css for modern techniques.

Link to comment
Share on other sites

I don't think it's possible to use \n within a document.writeIn, probably because you are writing html to the page and \n is not markup language. To create a new line use the <br /> tag.document.writeln('<font size=3 face=verdana>'+name+'</font><br />');document.writeln('<font size=3 face=verdana>'+age+'</font>');You can use \n for things like alert messages, this would insert a new line:alert("I am on \ntwo lines");<font> tag is out of date - check out css for modern techniques.
hi scott100, thanks for the reply and the tip. works perfectly now. thanks a lot :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...