I’m sorry

         I had found the answer. 

         If you want to change a script on the page, you must use
unsafeWindow to point it and hook the old function or var which the page
have.

         It could not be work when use unsafeWindow.test = xxxx , but there
isn’t any function which name test in the page.

 

 Best regards,

 

Suddy

E-mail:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]

 

website:  <http://www.alibaba.com/> suddymail.org 

  _____  

发件人: suddymail [mailto:[EMAIL PROTECTED] 
发送时间: 2008年8月28日 19:04
收件人: '[email protected]'
主题: some question about global function

 

Hi all

         I want to use userscript to fix some script with the website.

         But when I use the script like that:

// ==UserScript==

// @name          Hello World

// @namespace     http://diveintomark.org/projects/greasemonkey/

// @description   example script to alert "Hello world!" on every page

// @include       *

// @exclude       http://diveintogreasemonkey.org/*

// @exclude       http://www.diveintogreasemonkey.org/*

// ==/UserScript==

window.helloworld = function() {

    alert('Hello world!');

}

window.setTimeout("helloworld()", 60);

but it doesn’t work yet.

I want to define a js function in user script and then call them from the
web page.

How could I do?

 

 

 Best regards,

 

Suddy

E-mail:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]

 

website:  <http://www.alibaba.com/> suddymail.org 

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" 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/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to