![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
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?? |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
...
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... |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|