SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NN JavaScript Problem

    I have a textarea that is supposed to display a description for a book, and the description changes, depending upon which book cover is hovered over. Well, it works in IE 5.5, anyway. However, when I try it in NN 4.08, it complains "document.desc.bookDesc has no properties."

    Here's the HTML code for the form:
    Code:
    <form name="desc" action="#">
    <textarea name="bookDesc" rows="8" cols="60" class="bookDesc">
    Hover over a book cover for a short description.
    </textarea>
    </form>
    And here is the JavaScript:
    Code:
    var ttc_desc="It was the best of times, it was the worst of times.";
    
    function describe(book) {
     if (book!="") {
      document.desc.bookDesc.value=eval(book+"_desc");
     }
    }
    In the <img> tag of each book cover is this snippet:
    Code:
    onmouseover="describe('ttc')"
    So why doesn't Netscape work with it? textarea.value is a JavaScript 1.0 property, so it's not like I'm trying to do something IE exclusive.

    I've also tried just document.bookDesc.value, but I get the same error.

    Your help is greatly appreciated.
    Last edited by Percipient; Jun 22, 2001 at 09:52.
    Ed Rands

  2. #2
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Montreal, CAN
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My guess is that you must refer to the form using the forms[] array...

    Try something like:

    Code:
    document.forms[0].bookDesc.value = [...]
    I think that would solve your problem.... But it's just a guess...

    Cya,

    GB

  3. #3
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope, that didn't work. Thanks anyway.

    I've tried it in Netscape 6, and I get no troubles. Works just like expected. Now to install NN 4.7 and try it.
    Ed Rands

  4. #4
    SitePoint Enthusiast slp's Avatar
    Join Date
    May 2001
    Location
    Australia
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried out your code in NN 4.04 and it seemed to work fine.


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
  •