WordPress.org

Support

Support » How-To and Troubleshooting » Add 'onload' command to the body class

Add 'onload' command to the body class

  • OK I am a rookie and need a little guidance
    I have a cgi program that rotates images.

    I NEED to add this >>>> onLoad=”loadrandoms()”
    TO THIS
    <body class=”<?php hybrid_body_class(); ?>”>

    Any help would be appreciated
    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    @jdembowski

    Volunteer Mod. & Brute Squad

    That’s a very specific question for the Hybrid framework…

    My Theme Hybrid club membership expired (I switched to another theme) but this is a case where that membership fee would be well spent. That’s the sort of question that would be quickly answered in Justin Tadlock’s forums.

    Club

    OK, then how would I add the onload command here?

    <body <?php body_class(); ?>>

    should it not work the same?
    Michael

    Moderator Michael

    @alchymyth

    Forum Moderator

    afaik, ‘onload..’ gets added to the body tag, not to the body_class:

    http://www.w3schools.com/jsref/event_body_onload.asp

    OK,? but the tutorial you sent me to doesn’t tell me anything.

    How do i separate the two? I ASSUME I can’t have 2 <Body> tags? so I have to have the CLASS and the ONLOAD inside the BODY TAG, Correct?

    michael

    Moderator Michael

    @alchymyth

    Forum Moderator

    so I have to have the CLASS and the ONLOAD inside the BODY TAG, Correct?

    yes – and where is the problem?

    <body <?php body_class(); ?> onLoad="loadrandoms()">

    edit: unless you tell me that you tried it, and it id not work – then I have no idea…

    I tried it that way and it does not work. As stated in the original post I have to use the <body class=”<?php hybrid_body_class(); ?>”> along with the onload command.

    the onload command rotates a HERO Picture.

    here is an example where it is working on the html part of my website.
    http://www.goldstardads.org/members/community/

    But I need it to work on the WP portion of the website (root)- right sidebar Meet one of our Heroes – here
    http://goldstardads.org/

    I appreciate your help on this – it is an important part of the website for the members to know that when the public views our site they see our Heroes.

    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add 'onload' command to the body class’ is closed to new replies.