when i use document.writeln(text) the string in text (in this case paragraphs of info) are only displayed on one line
i need to know away so that like in html the text that will not fit in the window is rolled over to the next line
thanks
Printable View
when i use document.writeln(text) the string in text (in this case paragraphs of info) are only displayed on one line
i need to know away so that like in html the text that will not fit in the window is rolled over to the next line
thanks
If I understand you it should do that, it sounds like you've put it into a <pre> element or something. Try this for example:
Code:<script type="text/javascript"><!--
document.open();
document.writeln('<p>This is some long paragraph text, that should enable you to break down a line <\/p>');
document.close();
//--></script>
i havent put in any kind a pre element im trying to use documentiwriteln to print a varable that holds text on mutiple line like this (but this doesnt work):
Code:<script type="text/javascript"><!--
var text = "blablablaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
document.open();
document.writeln('<p>' + text + '<\/p>');
document.close();
//--></script>
Works for me :confused: Can up put the page up on the internet so we can take a look?
Are you saying that you want the <P> on one line, the text on another line, and the </P> on yet another line?Quote:
Originally posted by dogfish227
i havent put in any kind a pre element im trying to use documentiwriteln to print a varable that holds text on mutiple line like this (but this doesnt work):
Code:<script type="text/javascript"><!--
var text = "blablablaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
document.open();
document.writeln('<p>' + text + '<\/p>');
document.close();
//--></script>
i uploaded it
http://nategames00.tripod.com/example.html
OH I see what you mean. Well I think that's just HTML, if there's no where to break it won't break. There are a few solutions. You can either use characters like - or a space or something like that to wrap at those points. Or you can use a soft hypen, that says to the browser "if you need to you can wrap here, but put a hypen there if you do". You can use the entity where you think the text should wrap:
But that's a limitation of HTML (as far as I know) I'm afraid. There may be a fix in CSS, but I'm not sure.Code:var text = "bla&shy;bla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&shy;blabla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&shy;bla&shy;bla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
the work fine ill just make a simple program that takes the paragraph and puts those where the spaces are so i want have to tyoe it out a hundred times
thanks for your hepl