Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 24th, 2006, 4:02 AM   #1
guess
Programmer
 
Join Date: Feb 2006
Posts: 40
Rep Power: 0 guess is on a distinguished road
new line javascript

divText = window.opener.document.createTextNode('YOUR CHOİCE \n Start Day : '+val1);

I cant put a newline by this code but when I write \r instead of \n it works.However newline doesnt work.What can ı do??
guess is offline   Reply With Quote
Old Feb 24th, 2006, 6:24 AM   #2
guess
Programmer
 
Join Date: Feb 2006
Posts: 40
Rep Power: 0 guess is on a distinguished road
...

function addElement1()
    {
        var divElement;
        var divParent;
        var divText;
		var val1 = this.popupsend.startday.value;
		var text='YOUR CHOİCE \nStart Day :';

        divElement = window.opener.document.createElement("div");
        divText = window.opener.document.createTextNode(text+val1);
        divParent = window.opener.document.getElementById("divParent");

		divElement.style.color = "#FF0000";
		divElement.style.fontSize = "20pt";
		divElement.style.fontStyle = "italic";
		divElement.style.textAlign = "center";
		divElement.appendChild(divText);
        divParent.appendChild(divElement);
    }

Here is the code.I got the problem. Newline character doesnt work without pre tag in javascript.But this way,How will I be able to put a pre tag??? Because I am preparing the text in this child window and sending it to the parent...
guess is offline   Reply With Quote
Old Feb 24th, 2006, 8:45 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Use <br/> if you want a new line presentationally (as rendered by the browser for the client). If your concern is a new line in source view, than the newline should work for you.

Sorry the other code didn't work for you, but I intentionally tried to clarify your request up front, and you agreed it was correct. Presenting your issues clearly is something you need to work on.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:19 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC