Selecting the default button in a javascripted window that pops up??


I’m trying to write a script to utilize safari to log idle computers out of our wireless system… I’m able to get almost all of it working minus the fact that a window (javascripted) pops up with a “cancel” and “OK” button, but nothing seems to work in automating a keystroke of "return or “enter” to confirm the logout. I’ve tried :

tell application "System Events" to tell process "Safari"
	set frontmost to true
key code 13

end tell

tell application "System Events" to keystroke (ASCII character 3)

and numerous commands and none work.

Is there anyway to accomplish this.??.. BTW… the window does not have a name.

Thank you