|
-
Nov 24th, 2002, 04:58 PM
#1
Thread Starter
Hyperactive Member
document.writeln only one line
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
-
Nov 25th, 2002, 06:29 AM
#2
Frenzied Member
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>
-
Nov 25th, 2002, 04:59 PM
#3
Thread Starter
Hyperactive Member
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>
-
Nov 25th, 2002, 06:00 PM
#4
Frenzied Member
Works for me Can up put the page up on the internet so we can take a look?
-
Nov 25th, 2002, 06:08 PM
#5
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>
Are you saying that you want the <P> on one line, the text on another line, and the </P> on yet another line?
-
Nov 26th, 2002, 07:27 PM
#6
Thread Starter
Hyperactive Member
-
Nov 27th, 2002, 06:04 AM
#7
Frenzied Member
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:
Code:
var text = "bla&shy;bla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&shy;blabla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&shy;bla&shy;bla&shy;blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
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.
-
Nov 27th, 2002, 09:49 AM
#8
Thread Starter
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|