SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Red face Novice needs JS help

    I don't know diddly about JavaScript programming except how to cut and paste the darn things into my HTML. (How many times have you seen someone say this?)

    Anyhow, I have a classic JS error that shows up in IE but seems to be fine in Firefox (of course), on the home page of my site:

    link to page

    IE tells me that there's an error in Line 5, character 1873, expecting a ) where there isn't one.

    This is the entirety of Line 5:

    Code:
    <TITLE>This Far and No Further</TITLE>
    only 38 characters, and when I eyeball through the various scripts throughout the page, I don't see a missing closing parenthesis. But I could easily be missing something.

    Would someone with a trained eye take a quick look and tell me if something is wonky (besides the archaic tables and pre-CSS formatting)? I would certainly appreciate it.

    Max

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The error appears in Firefox too, only Firefox fails more gracefully. It's line 4 of headlines.php, which is an extremely long line of horrible HTML being written to the page using document.write. Within that line, there is the name Jaime O'Neill, which is causing the error, because the apostrophe isn't escaped. Solution: add a backslash ( \ ) before it.

    I'm curious why this is being done with document.write when it could just as easily be put in there as raw HTML?

  3. #3
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Thanks, Raffles

    Quick and dirty solution: rip the entire line of code out of there. Begone, bad HTML. Maybe O'Neill will fix the code on his end at some point. No great loss to my page anyway.

    Meanwhile, I'm having great fun converting the equally horrible caveman HTML formatting that I wrote myself to a far more graceful CSS formatting.

    Thanks again for taking a look.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Good luck with that and I'm glad you find it fun, there's always something satisfying about cleaning up a horrible mess!

  5. #5
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Well, fun is a relative term

    but productive nonetheless. I've trimmed some of the twigs and branches of the mess -- mostly font formatting and the like -- and am now preparing to tackle replacing the invasive table structure with tableless CSS. Easy for you guys, maybe, but tough for me. Thanks again!

  6. #6
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it will be good if you learn how to debug JS. Javascript has familiar syntax, and with such a dynamic language, one can simply understand and get along with it. The difficult part is that you need to learn browser specific function e.g. DOM traversing, assigning event, modifying style.

  7. #7
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    No doubt you're right, but

    I don't have a real interest in JS programming. I find scripts that serve a particular function that I want, and plug them in. If they don't work, I rip them out and either find another version of the same script that will work, or just do without. It's a strictly amateur approach. Hell, I worked with a typewriter for years after computers and word processors came out (though I became quite fond of PFS: Write once I finally got on board). It's just a matter of interest and preference. That's why I depend on you guys to help me out But if you want to know about American politics, or how your kid can read better, I'm your guy. One hand washes the other....


Bookmarks

Posting Permissions

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