www.webdeveloper.com
Results 1 to 6 of 6

Thread: Javascript Stack value display

  1. #1
    Join Date
    Jan 2013
    Posts
    20

    Javascript Stack value display

    Hello,

    I've got the follwing piece of code from my function:

    document.getElementById('userText').innerHTML = val;
    document.getElementById("fowrardDisplay").value=forwardStack+"\n"
    currentVal = val;

    "forwardDisplay" is textarea. Array items displayed in that textarea must be separated by break (create a comumn rather than row with commas). The code, however, still displays items in a row separated by commas. How can I fix this problem?

    I would appreciate any help.
    Thanx a lot.

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,390

    Question

    I'm a bit confused.

    Are you trying to create a 'table' like display within the <textarea> element?
    Rows and Columns of the elements of the 'forwardStack'? What are the contents of the stack? Numbers or strings or ???
    Can you provide an example of what the display is to look like?

  3. #3
    Join Date
    Jan 2013
    Posts
    20

    Array

    Quote Originally Posted by JMRKER View Post
    I'm a bit confused.

    Are you trying to create a 'table' like display within the <textarea> element?
    Rows and Columns of the elements of the 'forwardStack'? What are the contents of the stack? Numbers or strings or ???
    Can you provide an example of what the display is to look like?
    JMRKER, can I ask for your email so I can send you my code? The reason why I haven't put it here is because this is the project that has multiple people working on it. So I can't make my code to be seen here.
    Actually the page has user input box where the user enters values (they might be letters, or numbers). After that the values get pushed to a stack and displayed in that textarea as outputs. But the problem is that they are displayed in one row like this: a,b,c,d,e.... What I need to do is to get them displayed in a column format without commas:
    a
    b
    c
    d
    e

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,390

    Lightbulb

    Try...
    Code:
    ...
    document.getElementById('userText').innerHTML = val;
    document.getElementById("fowrardDisplay").value=forwardStack.join("\n")
    currentVal = val;
    Note also your mis-spellings.

  5. #5
    Join Date
    Jan 2013
    Posts
    20

    Thanks

    Thank you so much, it works!

  6. #6
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,390
    You're most welcome.
    Happy to help.
    Good luck.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles