Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   new line javascript (http://www.programmingforums.org/showthread.php?t=8555)

guess Feb 24th, 2006 4:02 AM

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 Feb 24th, 2006 6:24 AM

...
 
:

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...

DaWei Feb 24th, 2006 8:45 AM

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.


All times are GMT -5. The time now is 7:44 PM.

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