robokopf Posted September 9, 2006 Share Posted September 9, 2006 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 More sharing options...
scott100 Posted September 9, 2006 Share Posted September 9, 2006 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 More sharing options...
robokopf Posted September 10, 2006 Author Share Posted September 10, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now