Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Problems with "onload" and XHTML Validation

    Hello,

    My name is Manuel, I am a web design student and am starting to take my first steps with web design. Recently I tried to validate

    this site:

    http://accesosnormalizados.com

    I used the W3C validator, at first I found about 30 errors, and can correct them all except one that says: 'there is no attribute

    "onload"'.

    Apparently not support XHTML onload tag, and I use a Joomla extension called Vertical Menu using onload. This is a free extension

    and works well but I have found it has some bugs, especially when validating the website.


    The problem is at the end:



    echo '<img src="modules/mod_vertical_menu/images/center.gif" style="display:none" onload="new WW.VerticalMenu({out:'.$params-> get (' categorymenu_out ', 0.8). 'over'. $ params-> get ('categorymenu_over', 1). ', duration:'. $ params-> get ('categorymenu_fade', 300). ', id:'. $ GLOBALS ['vertical_menu' ]. ', width:'. $ params-> get ('categorymenu_width', 150). '}); "alt =" "/>';

    echo '</ div>';

    ?>

    I think the extension uses the onload event to display the sub-menus when the user moves the mouse pointer over it.

    What I want is to replace the onload with other event handler or some other label that is supported by XHTML and that is as similar to onload.

    I would appreciate your help ...

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    You can't use the onload attribute on any element other than <body>.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,589
    Thanks
    0
    Thanked 644 Times in 634 Posts
    If you put the JavaScript just before the </body> tag then you don't need to use onload at all.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New Coder
    Join Date
    Nov 2012
    Location
    India
    Posts
    53
    Thanks
    0
    Thanked 3 Times in 3 Posts
    First of all create the separat file for the java script.


  •  

    Tags for this Thread

    Posting Permissions

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