Well I''ve just started using Prototype as of last week, and I like it so far but I just started using the Event. set today and I''m having some problems... I have absolutely no idea how to trigger an Event.observe properly so that the function in the observe can have more variables passed to it at a later time. Am I just going about this the wrong way? Skined down version of the function I''m writing: function mouseFollow(type, var) { var mouse_x = Event.pointerX(event) + 8; var mouse_y = Event.pointerY(event) + 8; $(''mouse_x'').update(mouse_x); $(''mouse_y'').update(mouse_y); if (type == "over") { $(''info'').setStyle({ ''z-index'': "200" }); $(''info'').update(var); } else { $(''info'').update(""); } } It works fine in IE6, however FF spits out "Error: event has no properties" errors. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Try this: <script language="javascript"> otherparameter = "XX" anotherparameter = "YY" Event.observe(document, ''mousemove'', function(e) {myFunction(e,otherparameter,anotherparameter)}); function myFunction(e,a,b) { $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + Event.pointerY(e) + " A:" + a + " B:" + b } </script> </head> <body> <div id=''temp''></div> On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well I''ve just started using Prototype as of last week, and I like it > so far but I just started using the Event. set today and I''m having > some problems... I have absolutely no idea how to trigger an > Event.observe properly so that the function in the observe can have > more variables passed to it at a later time. > > Am I just going about this the wrong way? > > Skined down version of the function I''m writing: > function mouseFollow(type, var) { > var mouse_x = Event.pointerX(event) + 8; > var mouse_y = Event.pointerY(event) + 8; > $(''mouse_x'').update(mouse_x); > $(''mouse_y'').update(mouse_y); > > if (type == "over") { > $(''info'').setStyle({ > ''z-index'': "200" > }); > $(''info'').update(var); > } else { > $(''info'').update(""); > } > > } > > It works fine in IE6, however FF spits out "Error: event has no > properties" errors.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
This should work <script type="text/javascript"> // look at http://prototypejs.org/api/function/bindAsEventListener for an explanation function myFunction(e,a,b) { ... } Event.observe(document, ''mousemove'', myFunction.bindAsEventListener(document, 1, 2)); </script> On 9/6/07, Diodeus <diodeus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Try this: > > <script language="javascript"> > otherparameter = "XX" > anotherparameter = "YY" > Event.observe(document, ''mousemove'', function(e) > {myFunction(e,otherparameter,anotherparameter)}); > > function myFunction(e,a,b) { > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > Event.pointerY(e) + " A:" + a + " B:" + b > } > </script> > </head> > <body> > <div id=''temp''></div> > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Well I''ve just started using Prototype as of last week, and I like it > > so far but I just started using the Event. set today and I''m having > > some problems... I have absolutely no idea how to trigger an > > Event.observe properly so that the function in the observe can have > > more variables passed to it at a later time. > > > > Am I just going about this the wrong way? > > > > Skined down version of the function I''m writing: > > function mouseFollow(type, var) { > > var mouse_x = Event.pointerX(event) + 8; > > var mouse_y = Event.pointerY(event) + 8; > > $(''mouse_x'').update(mouse_x); > > $(''mouse_y'').update(mouse_y); > > > > if (type == "over") { > > $(''info'').setStyle({ > > ''z-index'': "200" > > }); > > $(''info'').update(var); > > } else { > > $(''info'').update(""); > > } > > > > } > > > > It works fine in IE6, however FF spits out "Error: event has no > > properties" errors. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Errr, I need to pass the variables from an onMouseOver in a div, the variables are dynamically generated by PHP - so... Errr Any way to do that? On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try this: > > <script language="javascript"> > otherparameter = "XX" > anotherparameter = "YY" > Event.observe(document, ''mousemove'', function(e) > {myFunction(e,otherparameter,anotherparameter)}); > > function myFunction(e,a,b) { > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > Event.pointerY(e) + " A:" + a + " B:" + b} > > </script> > </head> > <body> > <div id=''temp''></div> > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Well I''ve just started using Prototype as of last week, and I like it > > so far but I just started using the Event. set today and I''m having > > some problems... I have absolutely no idea how to trigger an > > Event.observe properly so that the function in the observe can have > > more variables passed to it at a later time. > > > Am I just going about this the wrong way? > > > Skined down version of the function I''m writing: > > function mouseFollow(type, var) { > > var mouse_x = Event.pointerX(event) + 8; > > var mouse_y = Event.pointerY(event) + 8; > > $(''mouse_x'').update(mouse_x); > > $(''mouse_y'').update(mouse_y); > > > if (type == "over") { > > $(''info'').setStyle({ > > ''z-index'': "200" > > }); > > $(''info'').update(var); > > } else { > > $(''info'').update(""); > > } > > > } > > > It works fine in IE6, however FF spits out "Error: event has no > > properties" errors.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Anyone? On Sep 6, 2:22 pm, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Errr, I need to pass the variables from an onMouseOver in a div, the > variables are dynamically generated by PHP - so... Errr Any way to do > that? > > On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Try this: > > > <script language="javascript"> > > otherparameter = "XX" > > anotherparameter = "YY" > > Event.observe(document, ''mousemove'', function(e) > > {myFunction(e,otherparameter,anotherparameter)}); > > > function myFunction(e,a,b) { > > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > > Event.pointerY(e) + " A:" + a + " B:" + b} > > > </script> > > </head> > > <body> > > <div id=''temp''></div> > > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Well I''ve just started using Prototype as of last week, and I like it > > > so far but I just started using the Event. set today and I''m having > > > some problems... I have absolutely no idea how to trigger an > > > Event.observe properly so that the function in the observe can have > > > more variables passed to it at a later time. > > > > Am I just going about this the wrong way? > > > > Skined down version of the function I''m writing: > > > function mouseFollow(type, var) { > > > var mouse_x = Event.pointerX(event) + 8; > > > var mouse_y = Event.pointerY(event) + 8; > > > $(''mouse_x'').update(mouse_x); > > > $(''mouse_y'').update(mouse_y); > > > > if (type == "over") { > > > $(''info'').setStyle({ > > > ''z-index'': "200" > > > }); > > > $(''info'').update(var); > > > } else { > > > $(''info'').update(""); > > > } > > > > } > > > > It works fine in IE6, however FF spits out "Error: event has no > > > properties" errors.- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
write hidden inputs to the page with ids and value= whatever in php from your php and read them in the client side javascript with $f Gareth On 9/7/07, Sykoi <sykoii-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Anyone? > > On Sep 6, 2:22 pm, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Errr, I need to pass the variables from an onMouseOver in a div, the > > variables are dynamically generated by PHP - so... Errr Any way to do > > that? > > > > On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Try this: > > > > > <script language="javascript"> > > > otherparameter = "XX" > > > anotherparameter = "YY" > > > Event.observe(document, ''mousemove'', function(e) > > > {myFunction(e,otherparameter,anotherparameter)}); > > > > > function myFunction(e,a,b) { > > > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > > > Event.pointerY(e) + " A:" + a + " B:" + b} > > > > > </script> > > > </head> > > > <body> > > > <div id=''temp''></div> > > > > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Well I''ve just started using Prototype as of last week, and I like > it > > > > so far but I just started using the Event. set today and I''m having > > > > some problems... I have absolutely no idea how to trigger an > > > > Event.observe properly so that the function in the observe can have > > > > more variables passed to it at a later time. > > > > > > Am I just going about this the wrong way? > > > > > > Skined down version of the function I''m writing: > > > > function mouseFollow(type, var) { > > > > var mouse_x = Event.pointerX(event) + 8; > > > > var mouse_y = Event.pointerY(event) + 8; > > > > $(''mouse_x'').update(mouse_x); > > > > $(''mouse_y'').update(mouse_y); > > > > > > if (type == "over") { > > > > $(''info'').setStyle({ > > > > ''z-index'': "200" > > > > }); > > > > $(''info'').update(var); > > > > } else { > > > > $(''info'').update(""); > > > > } > > > > > > } > > > > > > It works fine in IE6, however FF spits out "Error: event has no > > > > properties" errors.- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Just write-out the values from PHP instead of hard-coding the following lines: otherparameter = "XX" anotherparameter = "YY" On Sep 7, 7:16 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Anyone? > > On Sep 6, 2:22 pm, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Errr, I need to pass the variables from an onMouseOver in a div, the > > variables are dynamically generated by PHP - so... Errr Any way to do > > that? > > > On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Try this: > > > > <script language="javascript"> > > > otherparameter = "XX" > > > anotherparameter = "YY" > > > Event.observe(document, ''mousemove'', function(e) > > > {myFunction(e,otherparameter,anotherparameter)}); > > > > function myFunction(e,a,b) { > > > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > > > Event.pointerY(e) + " A:" + a + " B:" + b} > > > > </script> > > > </head> > > > <body> > > > <div id=''temp''></div> > > > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Well I''ve just started using Prototype as of last week, and I like it > > > > so far but I just started using the Event. set today and I''m having > > > > some problems... I have absolutely no idea how to trigger an > > > > Event.observe properly so that the function in the observe can have > > > > more variables passed to it at a later time. > > > > > Am I just going about this the wrong way? > > > > > Skined down version of the function I''m writing: > > > > function mouseFollow(type, var) { > > > > var mouse_x = Event.pointerX(event) + 8; > > > > var mouse_y = Event.pointerY(event) + 8; > > > > $(''mouse_x'').update(mouse_x); > > > > $(''mouse_y'').update(mouse_y); > > > > > if (type == "over") { > > > > $(''info'').setStyle({ > > > > ''z-index'': "200" > > > > }); > > > > $(''info'').update(var); > > > > } else { > > > > $(''info'').update(""); > > > > } > > > > > } > > > > > It works fine in IE6, however FF spits out "Error: event has no > > > > properties" errors.- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''m very lost, and I''m not sure you get it - there could potentially be hundreds of values. On Sep 7, 9:19 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just write-out the values from PHP instead of hard-coding the > following lines: > > otherparameter = "XX" > anotherparameter = "YY" > > On Sep 7, 7:16 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Anyone? > > > On Sep 6, 2:22 pm, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Errr, I need to pass the variables from an onMouseOver in a div, the > > > variables are dynamically generated by PHP - so... Errr Any way to do > > > that? > > > > On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Try this: > > > > > <script language="javascript"> > > > > otherparameter = "XX" > > > > anotherparameter = "YY" > > > > Event.observe(document, ''mousemove'', function(e) > > > > {myFunction(e,otherparameter,anotherparameter)}); > > > > > function myFunction(e,a,b) { > > > > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > > > > Event.pointerY(e) + " A:" + a + " B:" + b} > > > > > </script> > > > > </head> > > > > <body> > > > > <div id=''temp''></div> > > > > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Well I''ve just started using Prototype as of last week, and I like it > > > > > so far but I just started using the Event. set today and I''m having > > > > > some problems... I have absolutely no idea how to trigger an > > > > > Event.observe properly so that the function in the observe can have > > > > > more variables passed to it at a later time. > > > > > > Am I just going about this the wrong way? > > > > > > Skined down version of the function I''m writing: > > > > > function mouseFollow(type, var) { > > > > > var mouse_x = Event.pointerX(event) + 8; > > > > > var mouse_y = Event.pointerY(event) + 8; > > > > > $(''mouse_x'').update(mouse_x); > > > > > $(''mouse_y'').update(mouse_y); > > > > > > if (type == "over") { > > > > > $(''info'').setStyle({ > > > > > ''z-index'': "200" > > > > > }); > > > > > $(''info'').update(var); > > > > > } else { > > > > > $(''info'').update(""); > > > > > } > > > > > > } > > > > > > It works fine in IE6, however FF spits out "Error: event has no > > > > > properties" errors.- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I believe he means something like <script type="text/javascript"> var otherparameter = "<?php echo $otherparameter; ?>"; var anotherparameter = "<?php echo $anotherparameter; ?>": alert(otherparameter + " " + anotherparameter); </script> On 9/8/07, Sykoi <sykoii-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m very lost, and I''m not sure you get it - there could potentially > be hundreds of values. > > On Sep 7, 9:19 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Just write-out the values from PHP instead of hard-coding the > > following lines: > > > > otherparameter = "XX" > > anotherparameter = "YY" > > > > On Sep 7, 7:16 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Anyone? > > > > > On Sep 6, 2:22 pm, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Errr, I need to pass the variables from an onMouseOver in a div, the > > > > variables are dynamically generated by PHP - so... Errr Any way to do > > > > that? > > > > > > On Sep 6, 8:14 am, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Try this: > > > > > > > <script language="javascript"> > > > > > otherparameter = "XX" > > > > > anotherparameter = "YY" > > > > > Event.observe(document, ''mousemove'', function(e) > > > > > {myFunction(e,otherparameter,anotherparameter)}); > > > > > > > function myFunction(e,a,b) { > > > > > $(''temp'').innerHTML = "X: " + Event.pointerX(e) + " Y: " + > > > > > Event.pointerY(e) + " A:" + a + " B:" + b} > > > > > > > </script> > > > > > </head> > > > > > <body> > > > > > <div id=''temp''></div> > > > > > > > On Sep 6, 8:45 am, Sykoi <syk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Well I''ve just started using Prototype as of last week, and I like it > > > > > > so far but I just started using the Event. set today and I''m having > > > > > > some problems... I have absolutely no idea how to trigger an > > > > > > Event.observe properly so that the function in the observe can have > > > > > > more variables passed to it at a later time. > > > > > > > > Am I just going about this the wrong way? > > > > > > > > Skined down version of the function I''m writing: > > > > > > function mouseFollow(type, var) { > > > > > > var mouse_x = Event.pointerX(event) + 8; > > > > > > var mouse_y = Event.pointerY(event) + 8; > > > > > > $(''mouse_x'').update(mouse_x); > > > > > > $(''mouse_y'').update(mouse_y); > > > > > > > > if (type == "over") { > > > > > > $(''info'').setStyle({ > > > > > > ''z-index'': "200" > > > > > > }); > > > > > > $(''info'').update(var); > > > > > > } else { > > > > > > $(''info'').update(""); > > > > > > } > > > > > > > > } > > > > > > > > It works fine in IE6, however FF spits out "Error: event has no > > > > > > properties" errors.- Hide quoted text - > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---