Personal computing discussed

Moderators: SecretSquirrel, just brew it!

Crayon Shin Chan
Minister of Gerbil Affairs
Topic Author
Posts: 2299
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Javascript: changing className with HTMLElement!=this

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">'.
if ( function_exists('register_sidebar') )
   'before_widget'=>'<div class="indwiget">',
   '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

Who is online

Users browsing this forum: No registered users and 5 guests