PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Object expected error in highlight script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Object expected error in highlight script

    I tried installing the highlighting script but I get Javascript error "Object expected" in IE7. I am using the latest Zoom version. The page has no other javascript in it, but lots of tables and a search form (Zoom, of course, although it is currently an older version).

    The URL for testing:

    http://www.hameyvision.com.au/zoom5_...ghlight=colour

    I have read previous posts dealing with javascript menus interacting with highlighting, but that does not apply in my case. I found a previous post about the object expected error (v4 zoom) but the person who solved it posted no solution .

  • #2
    OK, I've found the cause of the error, but I first have to ask ... what program are you using to modify your web pages? Because it is a very unusual problem.

    We first tried to verify the validity of the page in question(http://www.hameyvision.com.au/zoom5_...asurement.html), by entering it into the CSE HTML Validator. It failed to verify the script tag which links to "highlight.js" and claims that this tag is invalid. This would explain why you are getting an "Object expected" error (when your page later calls "highlight()", it is nowhere to be found, since the "highlight.js" file was never linked to the page).

    But why is that script tag incorrect? It looks valid and correct on the surface. Entering the same URL in the W3 Validator gets a similar error.

    We then looked at the HTML source code for the page ourselves (in the UltraEdit text editor). We switched to hexadecimal view, and we then saw the cause of the problem.

    The space character specified in your HTML <script> tag is NOT a standard ASCII space character (as required by HTML).



    The normal ASCII space character has a hexadecimal value of 20 (as you can see at the very beginning and end of the above portion of the code).

    Instead, the character you are using, which appears similar to a space character, is a different one with a value of A0.

    Somehow, when you copy and pasted the HTML for the highlight script, the program you used must have converted the space character to this value. I don't know of any Web Page Editor which would do this (as it breaks all HTML), so this is unusual. A0 appears to be the UTF-8 non-breaking space character (which would not be valid as part of HTML tags), so perhaps it has something to do with that, and you might have a better idea of what you did.

    The style tag just before the above extract (which specifies the .highlight CSS class) also has this problem, with all the space characters replaced by A0's.

    I would recommend reconsidering what tools you are using to develop your web pages, because you would most likely need to use something a bit more dependable to fix this problem. You could even just open the files in Notepad, and delete the existing space characters there, and replace them with one entered by simply pressing your spacebar.

    I hope that helps and is not too confusing. Let us know if you have questions.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Wow, thanks for that. I use Visual Studio .Net 2003 to edit web pages. You would think a product like that would be aware of this issue. When I copied from your web page and pasted it in, I had to edit the copied text because it came in with all the HTML tags. I'll watch out for this in future.

      p.s. Is there any way to prevent highlighting occurring in the entire page - to limit it to a particular object (perhaps identified by name)? It does not look good to highlight the keyword in the menu bar.

      ---
      Congratulations on an excellent product. Jakob Nielsen recommends a site search engine with word stemming, synonyms and highlighting of the matched terms on the target page. Your synonym capability extends nicely to word stemming for smaller sites, and your highlighting capability is great.

      Thanks...

      Comment


      • #4
        Thanks for the positive feedback.

        There is currently no built-in functionality to prevent highlighting on parts of the page. But this might be something for us to consider for a future release (perhaps skipping the sections marked with the ZOOMSTOP and ZOOMRESTART tags, to correspond with the indexing).

        In the meantime, you might be able to specify a different CSS class for .highlight which only applies to highlight tags within, say, the navigation table. In which case, you would be able to override the appearance of the highlighting when it occurs within the table, so that it is displayed normally and without the background colour/bold. This would depend on the HTML of the rest of the page, and whether the navigation menus are wrapped in a suitable class.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Once again, thank you for such good advice. It was easy to enclose the parts where highlighting is relevant in <div class="highlighted"> or to attach class="highlighted" to an existing enclosing element, and then change the CSS to

          .highlighted .highlight { ... }

          thus ensuring that only items of class highlight inside class highlighted would actually appear highlighted. Of course, the search template had to be changed similarly to enable highlighting within it.

          In general, the jump-to may not go the correct place, but in my case the menus appear after main content, so jump-to should produce the desired effect.

          Thanks again.

          Comment

          Working...
          X