+ Reply to Thread
Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By essellar

Thread: line break

  1. #1
    yangmingjie65 is offline x10Hosting Member yangmingjie65 is an unknown quantity at this point
    Join Date
    Dec 2011
    Posts
    1

    line break

    Hi,

    I wan to run javascript containing following code:

    var test1="21.0507865" + "\t"+ "21.0400039"+ "\t" + "21.06445655" + "\n" +
    "21.0107865" + "\t"+ "21.0200039"+ "\t" + "21.03445655" + "\n" +
    "21.0707865" + "\t"+ "21.0800039"+ "\t" + "21.09445655" + "\n" +
    "21.0607865" + "\t"+ "21.0600039"+ "\t" + "21.06445655"

    So my data can display in a textarea like following

    21.0507865 21.0400039 21.06445655
    21.0107865 21.0200039 21.03445655
    21.0707865 21.0800039 21.09445655
    21.0607865 21.0600039 21.06445655

    But when I paste my code in the RVSiteBuilder HTML edit window, “\” in my code was always deleted automatically, so my data can not be displayed normally. What should I do to avoid these kind things?

    Thanks for your attention.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: line break

    1. have you tried a double slash \\ ?

    2. maybe try embedding a real return, ie

    Code:
    var cr = "
    ";
    3. "Paste into"??? have you tried typing it in directly?
    Last edited by descalzo; 12-11-2011 at 07:27 PM.
    Nothing is always absolutely so.

  3. #3
    rajat.vaghani37 is offline x10Hosting Member rajat.vaghani37 is an unknown quantity at this point
    Join Date
    Nov 2010
    Location
    India
    Posts
    49

    Re: line break

    As far as i know /t and /n work only when printing/displaying the output. u cant add that in the variable, wont work like that.

  4. #4
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: line break

    Textareas are one of the few places where those characters will work as expected. It's perfectly valid to have them in a JavaScript string variable/object, but because all contiguous whitespace is treated as a single space character throughout most of HTML, you usually don't run across the tab and newline characters in production code. They are useful, though, in textarea and pre elements (and the now-deprecated pre equivalents, like code, tt, and so on) as well as in JavaScript alert boxes (alert, confirm, input).

    As for the SiteBuilder question -- I never touch those things, so I don't know. HTML is a WYSIWYM (what you see is what you mean) markup language; WYSIWYG (what you see is what you get) leaves meaning out of the equation, and leads to inaccessible sites by default. And as far as I'm concerned, if Jaws can't make sense of it, and you can't "view" the site properly on a Braille terminal, that's a failure.
    drelix7654 likes this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

+ Reply to Thread

Similar Threads

  1. Does this break the TOS?
    By olifoyle78 in forum Free Hosting
    Replies: 2
    Last Post: 01-21-2011, 11:22 AM
  2. Line break while writing txt file using php & form data
    By vaibhavy in forum Programming Help
    Replies: 3
    Last Post: 03-31-2010, 11:28 AM
  3. How many do you break?
    By Nathan H in forum Off Topic
    Replies: 1
    Last Post: 08-25-2008, 11:03 AM
  4. Play Line Rider? Line Rider Head Quarters is for you!
    By StingReay in forum Link Exchange
    Replies: 0
    Last Post: 07-07-2008, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers