[Greasemonkey] inserting a script on a HTML page

Fabien Bergeret fabien.bergeret at laposte.net
Wed Jun 8 15:56:03 EDT 2005


I'm currently working on a script that can translate dollars to euro.
Here is a sample of my code : 
GM_log("Entering analyseDocument "+coteDollar);
 //Creates the conversion script
 var script = document.createElement("script"); 
 GM_log("Script created");
 var contenuScript = 'function convertDollarsToEuros(amount){\nalert("$"+amount+"="+(Math.round(100*amount/'+coteDollar+'))/100+"EUR");\n}';  
 GM_log("Script fed "+contenuScript);
 //Doesn't work on eBay
 script.innerHTML = contenuScript;
 GM_log("Script inserted");

this code works fine on amazon.com, for instance, but, on ebay.com, the last message I have in the console is "Script fed". The line script.innetHTML = contenuScript doesn't seem to work.
Any idea why ?

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050608/f2448f3d/attachment.htm


More information about the Greasemonkey mailing list