Wouldn't something like this work?

function a(url) {
   new Effect.Fade("targetDiv");
   setTimeout(function() {dimmer(url);}, 2000);
}

function dimmer(url) {
  ....
}

TAG

On May 28, 2007, at 12:28 PM, jg wrote:

>
> This is the script I'm using to fade current content of targetDiv,
> update content with ajax, then fade in the new content -
> function a()
> {
> new Effect.Fade("targetDiv");
> setTimeout(dimmer, 2000);
> }
> function dimmer()
>
>       {
>           var url = "test1.html"
>           var myAjax = new Ajax.Updater(
>           "targetDiv",
>            url,
> {method: 'get', onSuccess: function ap() {
> new Effect.Appear("targetDiv");
> }
> }
> );
> }
>
> <div id="container">
> <a href="#" onclick="a()"; true false;>hello</a>
> <div id="targetDiv">
> <p>This is where the target lives!</p>
> </div>
> </div>
>
> This works fine for me. But What I want to be able to do is pass the
> url in an argument at the onclick -
>
> <a href="#" onclick="a("test.html")"; true false;>hello1</a>
>
> So that I can use the same script for multiple links updating the  -
> var url = "test1.html" to what ever url i pass it based on the link
> that is clicked.
> ie -
> <a href="#" onclick="a("test1.html")"; true false;>hello1</a>
> <a href="#" onclick="a("test2.html")"; true false;>hello2</a>
> <a href="#" onclick="a("test3.html")"; true false;>hello3</a>
>
> I know there must be a simple way of doing this.
> Please advise.
> Thank you kindly,
> jacob
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to