SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Enthusiast Morris Cornet's Avatar
    Join Date
    Jun 2002
    The Netherlands
    0 Post(s)
    0 Thread(s)

    Angry JavaScript problem... what the (meuh) am I doing wrong?

    Hey there,

    I'm currently working with a links database script. It uses a html template for every database item. The following code is written for every database record.
    <<source>> and <<header>> are database output fields for every record.
    When I use another page, which just outputs <<header>> and <<source>> for every database record, without the JavaScript, everything works fine.

    if (harakiri=="yes"){
    	knars = "<div align=right>";
    	knars = "<div align=left>";
    sourcer = "<<source>>";
    if (sourcer != sourcer_old){
    	document.write("</table></div><p>" + knars + "<table width=400><tr><th>" + sourcer + "</th></tr>");
    	sourcer_old = sourcer;
            countsource = 1;}
       	countsource ++;}
    As you can see in the code every record is displayed in its own table cell. Once <<source>> changes (the <<source>> field in this database record is different than the <<source>> field in the previous one), the table is closed, and a new table is started, with the current source as <th>.

    Everything worked fine, until I wanted to left-align every first table, put every second table right, and so forth.

    It didn't work. The first table was on the left, but then the second table was on the left too.
    The third, fourth and fifth table were on the right, and another four tables were left-aligned again. This look like random numbers to me.

    There was no link within the database content. The database didn't contain any html or JavaScript, so THAT can't be influental.

    If you have any idea how this is possible.. I would appreciate your reply.

    Thanks in advance,
    Morris Cornet
    Last edited by Morris Cornet; Jul 8, 2002 at 10:41.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts