I am a complete coding n00b and i'm trying to get the following done:
basically i'm generating a table with book related fields such as author, title etc, and the last column is supposed to have a link to the pdf. To save some work i thought on generating a dynamic 'id' for each <tr>. Then i just have to rename all the docs to "document(id number).pdf"
The problem is that i dunno where to begin, i've been reading on the getElementById () but no success yet.
Stupid Example of what i want:
<td><a href='document".$id.".pdf'>view pdf </a></td>
Any help will be greatly appreciated.
This best done with server side script, php, perl etc, your example has $id, looks like PHP variable to me.
You define the dataset then have php loop through it and produce the HTML output for you, you also can name your pdf anything, so as to be more descriptive for people who see the file later on their desktops for example.
Back to getElementById(), it simply returns a HTML element with that specific Id, you are going the wrong way with this I'm thinking.
and one thing, I am not sure that getElementById is supported by all browsers.
thx for the answers guys!
The thing was that i received a dvd with all the pdf plus an excel file with all the info, and the table is supposed to be to a multimedia cd, that's why i tought in js. I am currently converting the excel data to mysql tables, then i'll simply generate a table with some loops and copy paste it to a plain html file.
Thanks both for pointing me into the right direction
Originally Posted by tolio