Jump to content

How do I make a table in Javascript?


Patriot

Recommended Posts

I was told by a friend that i shouldnt use an unordered list in javascript for my site, he said that a table would be alot better, so i tried to make one the way i did the rest of the stuff, and needless to say i put the old back because the new didnt work.my site is briansplace.fcpages.comwhen the page first loads up there is a navigation on the left side, it works fine but i wanted to change the code from unordered lists to a table.i made a table that works fine in html, but is there a way to have the index page call an html instead of having to write and then call a javascript?(i know almost nothing about javascript!!)

Link to comment
Share on other sites

So your entire navigation resides in a single java script:http://briansplace.fcpages.com/navigation.jsinteresting . . .First, I'd take alook at your site in other browsers - the site doesn't seem to render properly in Firefox.Second, I have to ask what you overall intent is. By using the javascript in the context you have, you have made it so that you only need to change one file if the content of your navigation changes. There are other was to do this depending on your server environment. So, is your intent to have ONE file coded for your navigation that is then "included" on any page that you wish to call it on?Third, Don;t use tables unless you have to. You navigation can be generated without the use of tables since each item is simply on a new line. If you want the little bullet point but don't want the indenting that <ul> and <ol> have by default, then apply a "style" to then and adjust the margin, padding, and line-height as needed.Hope this helps.P.S. Welcome to the forums.

Link to comment
Share on other sites

So your entire navigation resides in a single java script:http://briansplace.fcpages.com/navigation.jsinteresting . . .i learned everythingI do or don't know about websites at w3school.com but actually started with html 4.0 for dummies book that i picked up at the computer store here.First, I'd take alook at your site in other browsers - the site doesn't seem to render properly in Firefox.My only intent for this site is for friends and family really, and one of the games i play to have some information for new players there to help them out a little, so im not concerned with anything but IE at this time.Second, I have to ask what you overall intent is.  By using the javascript in the context you have, you have made it so that you only need to change one file if the content of your navigation changes.  There are other was to do this depending on your server environment. So, is your intent to have ONE file coded for your navigation that is then "included" on any page that you wish to call it on?Yes one file that i can put on any pages/pages i choose, but only have to change once.Third, Don;t use tables unless you have to.  You navigation can be generated without the use of tables since each item is simply on a new line.  If you want the little bullet point but don't want the indenting that <ul> and <ol> have by default, then apply a "style" to then and adjust the margin, padding, and line-height as needed.ok thanks, that actually helps alot, i like the simple js file that i made for my navigation, it works with no errors and i know how to add and change anything i need to there.*question? How would i change the margin-padding so that when i dont have a bullet there but i do have the (new) there, they will all be lined up?Hope this helps.P.S. Welcome to the forums.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...