Problem with html and javascript

Discussion in 'Tech Discussion' started by gheist1234, Apr 19, 2018.

  1. Sheepo

    Sheepo 『Pyoo's Fated One』

    Joined:
    Jan 7, 2016
    Messages:
    278
    Likes Received:
    437
    Reading List:
    Link
    And here I am...working in a company where it's mandatory for a manufacturing engineer to atleast have a basic unserstanding of networking/application development/databases so they can possibly optimize the manufacturing process. Even if not fixing it, but atleast being able to point out and describe the problem to the IT department...
     
  2. Truerror

    Truerror Well-Known Member

    Joined:
    Jan 10, 2016
    Messages:
    546
    Likes Received:
    292
    Reading List:
    Link
    No. You're gonna get downvoted to oblivion. As a general rule, you don't ask homework questions on SO. It's frowned upon, especially if you set a deadline ("tomorrow night", in this case).

    Might get away with it if you're really lucky though. If OP thinks he's got his lucky star shining today, he's welcome to try.
     
    Warnock likes this.
  3. Warnock

    Warnock Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    142
    Likes Received:
    134
    Reading List:
    Link
    You sure its manufacturing engineer? I deal with quality shit (ISO) im nowhere near touching the assembly line
     
  4. gheist1234

    gheist1234 |Path Finder| 『WuxiaWworld Vet.』|Beardy| |Zen|

    Joined:
    Jan 18, 2016
    Messages:
    583
    Likes Received:
    810
    Reading List:
    Link
    Then what can i do? how do i change those insert.cell to appendchild and createElement? I am really desperate dude..
     
  5. Truerror

    Truerror Well-Known Member

    Joined:
    Jan 10, 2016
    Messages:
    546
    Likes Received:
    292
    Reading List:
    Link
    I don't really get what you're confused about. You simply use appendChild instead of insertCell, because you'll be using a list. Simply put, you have a list (most likely empty at first, though you may put boilerplate in there), and some kind of input (text box, probably), and a button that, when clicked, would use appendChild to put whatever is in that text box into your list.

    Or do you mean to say you already have existing data you use in your table and you'd need a way to automatically reuse that data for your list? If so, you might want to write a simple script for that.
     
  6. gheist1234

    gheist1234 |Path Finder| 『WuxiaWworld Vet.』|Beardy| |Zen|

    Joined:
    Jan 18, 2016
    Messages:
    583
    Likes Received:
    810
    Reading List:
    Link
    Still don't have existing data, it's by inputs, what i was confused about was on where to create the apendchild, and how to best substitute the insertCell, as we have never taken code we already have and converted it from tables to list, we always wrote from scratch
     

    Attached Files:

    • 123.png
      123.png
      File size:
      8.8 KB
      Views:
      108
    Last edited: Apr 20, 2018
  7. Truerror

    Truerror Well-Known Member

    Joined:
    Jan 10, 2016
    Messages:
    546
    Likes Received:
    292
    Reading List:
    Link
    If you're confused about how to use appendChild, maybe you should start with this? Basically, you get the element you want to append the addition to (the list in this case), and pass in the addition as a parameter to appendChild.

    Edit:
    Uh... I meant "argument"... you pass it in as an argument...

    To any coder reading this particular post, please don't murder me. :notworthy:
     
    Last edited: Apr 20, 2018
    gheist1234 likes this.
  8. gheist1234

    gheist1234 |Path Finder| 『WuxiaWworld Vet.』|Beardy| |Zen|

    Joined:
    Jan 18, 2016
    Messages:
    583
    Likes Received:
    810
    Reading List:
    Link
    I think i get it, will try to see a bit more about this and read more and will try to make it by tonight since i don't need to style it with css.
    Thank you very much brother!
     
  9. TamaSaga

    TamaSaga Well-Known Member

    Joined:
    Oct 11, 2016
    Messages:
    1,726
    Likes Received:
    2,173
    Reading List:
    Link
    Ah, damn, I missed this.

    First you need to change table to ul.
    Then you just let ul = document.querySelector("ul");

    Then you create "li" elements.
    Add the content with innerHTML
    Then you just use appendChild to add those li's to that ul.
     
    gheist1234 likes this.
  10. tom.chris

    tom.chris Not Good in English

    Joined:
    Mar 9, 2018
    Messages:
    273
    Likes Received:
    65
    Reading List:
    Link
    On Stack Overflow ur question gets answer faster and they're very friendly.

    I use Stack Overflow a lots because same question get asked a lots there :p