Javascript: changing className with HTMLElement!=this

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

Javascript: changing className with HTMLElement!=this

Postposted on Wed Mar 04, 2009 10:54 pm

The situation: I have Wordpress 2.7.1, and I only want to display the title of a widget, not its contents. The contents will be displayed when the user puts the mouse over the text of the title.

I figured using Javascript to change classes using onmouseover and onmouseoff would be a reliable way that works in IE5,6 as well. My JS isn't that great, though, so I'm having trouble expressing '<div class="widcontent">' under 'this', where 'this' is '<div class="widtitle">'.
Code: Select all
<?php
if ( function_exists('register_sidebar') )
    register_sidebar(array(
   'before_widget'=>'<div class="indwiget">',
   'after_widget'=>'</div></div>',
   'before_title'=>'<div class="widtitle" onmouseover="widcontent?.className=\'widcontentv\'">',
   'after_title'=>'</div><div class="widcontent">',
   ));
?>


Help? Thanks!
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2253
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 3 guests