2010-11-22 5 views

Répondre

0

Bien sûr, il est possible. Il y a plusieurs façons, l'une des façons est de joindre la variable que vous souhaitez transmettre à l'objet window. Ce n'est pas la seule solution et certainement pas le plus solution élégante, mais, cela fonctionne.

donc quelque chose comme ceci:

// processingjs code... 
window.varIWantToPassAround = "whatever"; 

// jQuery code... 
// as long as you don't redefine the variable "varIWantToPassAround", you can reference it without referencing the window object. IE "window.varIWantToPassAround" 
// but I like to be explicit so when I read my code 3 months later and go "where did *that* come from, I can see it is attached to the window object. 
$("#unicorn_powerd_div").someFunctionThatGrowsMagicUnicorns(window.varIWantToPassAround); 
Questions connexes