I'm trying to create an iframe that points to an external page, in an
event-driven fashion.

I've started by modifying the working example of "using an iframe"
posted here:
http://userscripts.org/scripts/show/67098

That script works, but only runs when the page is loaded.  My script
responds
to the event (pressing the escape key), but when it runs it only
creates a blank
iframe.  Could someone suggest how to get it to display the external
URL I'm
asking for?

// ==UserScript==
// @name      Event-driven iframe in greasemonkey
// @namespace  http://userscripts.org/users/110447
// @description    A non-working example of how to use iframes in
greasemonkey
// @version                0.1
// @include        *
// ==/UserScript==

document.addEventListener("keypress", function(e) {
  if(!e) e=window.event;
  var key = e.keyCode ? e.keyCode : e.which;
  if ( key === 27 ) {
      var makeIframe = document.createElement("iframe");
      makeIframe.setAttribute("height", "100%");
      makeIframe.setAttribute("width", "50%");
      makeIframe.setAttribute("src", "http://google.com";);
      document.documentElement.appendChild(makeIframe);
    }
}, true);

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to greasemonkey-us...@googlegroups.com.
To unsubscribe from this group, send email to 
greasemonkey-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to