![]() |
text in a table cell
I'm not sure if this is possible. I have tried numerous ways of doing this, so either I am missing something or it just can't be done.
In the body of my page I have a table with 5 rows and 2 colums. I want to display a different string in each cell of the left column and a different integer in each cell of the right column. So it would look something like this: ----------------- | String 1 | 52 | | String 2 | 40 | | String 3 | 13 | | String 4 | 56 | | String 5 | 97 | ----------------- In the head of my page I included 10 variables; 5 for each string and 5 for each integer. In the table cells I want to be able to display the strings and the integers so that I can update them in one place later when needed without having to find each cell in the html code or using a database since the amount of data is so small. Please help if you have any ideas. Thanks. |
If you mean you have the strings and integers in JavaScript variables, you can use the innerHTML property. For example:
:
... |
You could also use session variables, although that can be risky. Either way (ooble's or mine) without a db you will still have to find them in code and change them. With session vars you could have a page with a form to modify them, though.
BaldEagle |
:
<script type='text/javascript'>hmmm, cant figure out how to make 2 cells with the rows. but i should be close |
I realize that I still have to find the variables in code, but my reasoning was that someone without any knowledge of HTML was going to be updating this specific page on a weekly basis and I was trying to do it in a manner in which they could easily find all of the data in one location within the file without having to download a wysiwyg editor. Using javascript variables allows them to avoid searching through the code for each table cell so they can quickly make simple changes. I was trying not to include more info than was needed, so I left this out and so I can see how excluding this bit of info would lead to confusion about not using a database. Thanks so much for all of your help. I chose to use Ooble's suggestion and it worked exactly as I was hoping.
|
Good to hear it. I suggest porting it to a server-side scripting language such as PHP when you can so they don't have to touch the code at all, though - this way, if someone has JavaScript turned off, they won't see a damn thing.
|
| All times are GMT -5. The time now is 6:07 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC