On Sunday, April 5, 2015 at 8:17:42 AM UTC-4, raja ammar wrote: > > Hi ; > My project is devised on 3 files. I declared a variable in file.js and i > have to use this variable in file.html.how can i send this variable to > file.html without declaration in this file? > In fact the error is ReferenceError: ua is not defined. > please can you help me. > > That doesn't sound like a node.js question -- more like browser javascript. This list isn't really the place for browser javascript questions, but let's see if this helps.
If it is indeed a browser question, you can use variables like that globally by making them properties of window: window.ua = whatever Also variables at the top level (not wrapped in a function) in plain browser javascript are shared, so just the declaration will work. However, if you use a module system like browserify, everything is wrapped in functions, so that doesn't work and you have to use the global "window" object. Aria -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/43d3422d-b65e-4a1e-a8ab-00303394e2fb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
