SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onmouseover object doesnt support property or method error

    I am trying to develop a text editor system for a forum board I am creating, something similar to what sitepoint used to have when adding new topics/replies.

    My current problem is trying to get an input type of 'button' to use an onmouseover event that has a userdefined javascript function. My code for the button is as follows:
    Code:
     <input type='button' accesskey='u' style='width: 30px' value='URL' name='btnHttp' onClick="tagInsert('link');" onmouseover="help('u')">
    The javascript function "help" is defined in the body of the page, as such:
    Code:
      <script language="JavaScript" type='text/javascript'>  
      function help(helptag) 
      {
       alert(helptag);
      }  
     </script>
    Now, when I mouseover the button on the page, I get a Javascript error:
    Object doesn't support this property or method.

    Why am I getting this error? If I change the onmouseover call to use something like "alert('testing');" the alert works fine. I also tried using window.status='testing'; and it worked fine as well. Why won't it call me predefined function? I have tried changing the name of the function to several different things (in case 'help' was a javascript keyword or something) but that didn't work either. When I remove the onmouseover altogether the page runs fine, without error. What am I missing here?

    Please help me. I'm about to pull my hair out.

    - krayzie

  2. #2
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Works for me, tested it in IE6, N7, Opera 7:
    Code:
    <html>
    <head>
      <script type="text/javascript">  
      function help(helptag) 
      {
       alert(helptag);
      }  
     </script>
    </head>
    <body>
    <form>
    <input 
      type='button' accesskey='u' 
      style='width: 30px' value='URL' 
      name='btnHttp' 
      onclick="tagInsert('link');" 
    onmouseover="help('u')" />
    </form>
    </body>
    </html>
    -xDev

  3. #3
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right, xDev. Trying just that code in an html form works.

    However, having the code embedded in my pages still doesn't work. I'm not sure what would prevent it from working correctly. What type of headers need to be sent to correctly make something like this work?

    Unfortunetly I don't have this on an external server that you can view yet. My host has had it's ftp access down for the past day so I haven't been able to upload my changes yet. This is all being done on a home server.

    The general gist of the page is its a normal php page (far as I can tell) which contains an iframe. Inside this iframe is where the input button lives that is having the problem. Is there anything upfront that you can think of that would be causing the issue? I will post again when I am able to upload the pages to my host.

  4. #4
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krayziepjf
    You are right, xDev. Trying just that code in an html form works.

    However, having the code embedded in my pages still doesn't work.
    Without seeing all your code, it's hard to say. You said that the button is in an iframe. Where is the function, in the parent html or the iframe itself? What other functions do you have? How exactly are you calling the function? You see what I mean ... Show me all the code for your html page and I'll fix your problem. Attach it if you have to.

    -xDev
    Last edited by xDev; Jul 30, 2003 at 04:23.

  5. #5
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Turns out that 'help' is a reserved keyword. Changing the name of the function to something else did the trick. I swear I tried this last night, but it was 230am so who knows what I was doing anymore.

    Thank you for your help xDev!!!

    - krayzie

  6. #6
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krayziepjf
    Turns out that 'help' is a reserved keyword. Changing the name of the function to something else did the trick. I swear I tried this last night, but it was 230am so who knows what I was doing anymore.

    Thank you for your help xDev!!!

    - krayzie
    No, problem!

    Cheers,
    -xDev


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
  •