Take a look at this W3 schools link, it may help:
http://www.w3schools.com/jsref/jsref_onkeypress.asp

Note how they pass the event from the link:

onmousedown="getEventTrigger(event)"

vs

onmousedown="getEventTrigger()

Maybe that will help - andy



On Thu, Mar 12, 2009 at 1:06 PM, <andrew.d...@lthree.com> wrote:

>
> Thanks for all your help on this - I wouldn't have gotten this far
> without it. I have attached to an onclick of a link, and the function
> is being called. My only remaining issue is a missing 'event' object
> in the js. This is on ie. Here is the js function being attached to
> onclick:
>
>    onclick_js =   "function(){"
>    onclick_js =   "  alert('button clicked');"
>    onclick_js +=  "  event = window.event;"
>    onclick_js +=  "  if(event){"
>    onclick_js +=  "    alert('found event');"
>    onclick_js +=  "  } else { "
>    onclick_js +=  "    alert('no event available'); "
>    onclick_js +=  "  }"
>    onclick_js +=  "}"
>
> I get the alert 'button clicked' and then 'no event available'.
>
> Has anyone tried this and/or have any ideas on what to try. (I have
> tried passing event as a parm to the funcion - no difference).
>
> In case it helps, here is the code that attaches this js to the
> onclick.
>
>    js = "var top_frame=document.getElementById('top_frame');"
>    js +="if(top_frame){"
>    js +="  var myelem=top_frame.contentWindow.document.getElementById
> ('" + html_id  + "');"
>    js +="  if(myelem){ "
>    js +="    myelem.onclick=" + onclick_js + ";"
>    js +="  }"
>    js +="};"
>
>    #puts "exec_js is " + js
>
>    SITE.browser.document.parentWindow.execScript(js, "javascript")
>
> On Mar 11, 1:04 pm, andrew.d...@lthree.com wrote:
>


<snip>...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to