If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Damn lol sorry if I offended anyone (or everyone for that matter). The only reason I'm using JS to create HTML is because my professor wants us to learn DHTML. I'm all for separating the HTML and JS, but he insists on this way (go figure). Anyway, THANKS ALOT

Repost your revised code. I didn't see anything there where the first would interfere with the second.

Commentary only: There's nothing wrong with learning DHTML, but doing it by just converting static HTML into static JavaScript isn't the best way to go about it.

I *suspect* that what the professor really wanted you to do was to create two tables and forms in such a way that you used a function and/or loop, so that you didn't have to nearly (but not quite) clone the code for the second table.

*THAT* would make some sort of sense.

Even so, creating DHTML using innerHTML isn't the best way. Hopefully he will also be teaching you about using document.createElement() and the DOM methods.

The only reason I'm using JS to create HTML is because my professor wants us to learn DHTML. I'm all for separating the HTML and JS, but he insists on this way (go figure). Anyway, THANKS ALOT

Simply creating the code as HTML and then attaching it using innerHTML isn't really using JavaScript to create the table - it is using HTML to create the table and simply using JavaScript to add it to the page.

If you are creating a table from JavaScript you should use document.createElement() to create the table and tbody tags and then use insertRow() and insertCell() to add the rows and cells to the table. See http://javascriptexample.net/domtable12.php for an example of how to create a table using JavaScript.

Of course, Felgall, this assumes that the instructor has the foggiest notion about what is good JavaScript practice. If the idiot instructor thinks that innerHTML is the way to go, then he probably has no choice but to use crappy coding.

Of course, Felgall, this assumes that the instructor has the foggiest notion about what is good JavaScript practice. If the idiot instructor thinks that innerHTML is the way to go, then he probably has no choice but to use crappy coding.

While producing the crappy code that the instructor expects during the course is the easiest way to pass the course such code will not be useful after completing the course. At that point the person really needs to know how to write the code properly - so if the course is one that must be done in order to get a particular qualification then the person taking the course really needs to learn the proper way as well as the crappy way. If the course isn't required for a qualification then the better option is to dump the useless course and just learn how to do it properly.

By including examples of how the code should e written in the real world we let the person taking the course know how poor the course is and provide them with some information on what they will need to learn in order to use JavaScript properly. There also may be a slight possibility that the course is actually asking for the proper approach to be used and that the student has simply been misled by poor code that they have found elsewhere.