Divs don't have an onload event, and neither do trs. You might try
putting an id on the thing you want to highlight and call it from
either the body's onload, or by registering an observer on the window's
load event.
<div id="foo">some stuff to highlight</div>
<script type="text/javascript">
//inline script, be sure it comes after the thing you want to highlight
in the source order
new Effect.highlight('foo',{});
</script>
//extend the body tag...
body onload="new Effect.highlight('foo',{});"
//in the page head, with an unobtrusive observer
<script type="text/javascript">
Event.observe(window,'load',function(){
new Effect.highlight('foo',{});
});
</script>
Walter
On Jun 9, 2007, at 4:00 PM, Oltmans wrote:
>
> Hello all,
>
> I am very new to web development and recently heard about
> Scriptaculous library so I thought I should give it a try. I am trying
> to call the Effect.Highlight method on DIV's onload event but that's
> not working. I even tried to to call the Effect.Highlight method on
> Table's row onload method but it didn't work. I am trying to do
> something like
>
> <div id="div1" onload="new Effect.Highlight(this)">Highlight me</div>
>
> and
> <table>
> <tr onload="new Effect.Highlight(this)"><td>highlight me too</td></tr>
>
> </table>
>
> But to my dismay it is not working at all. I tried to search internet
> but didn't find anything relevant. I am a newbie and I understand that
> I need to study more Javascript to efficiently write programs in this
> language. But I am unable to figure out why on earth Effect.Highlight
> doesn't work on onload event. Oh and yes, I tried both Firefox 1.x and
> IE 6.0 but it never worked. Can you please explain to me why is it not
> working. I will really appreciate any insights.
>
> Thanks and I look forward to hearing from you.
>
> --Oltmans
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---