By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

JS problem

P: n/a
First script, 'xxx.js' returns value 'document.write('integer');
So in HTML:

<script language='javascript' src='xxx.js'></script>

will write ie. 123 on my page in browser.

Can I get this integer or text 'document.write('integer')' to variable in
another script? So it would be something like this:

<script landuage='javascript>
a=<script ... src='xxx.js'></script>;
a*=20;
document.write(a);
</script>

Please help me.

--
Mike J.
mi****@o2.pl

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
VK
Not directly like in C++ (JavaScript doesn't support references
explisitly).
Plus the script by itself doesn't return any values. Functions in the
script do.
So whatever function does document.write(), you can:

1. Assign "integer" value to a global variable in your xxx.js
var glbInteger = null;
function write2doc (someValue) {
glbInteger = someValue;
document.write(someValue);
}
2. Add a property to any global object
self.document.glbInteger = someValue;
document,write(someValue);

Micha³ J. <mi****@o2.pl> wrote in message
news:Js*******************@news.chello.at...
First script, 'xxx.js' returns value 'document.write('integer');
So in HTML:

<script language='javascript' src='xxx.js'></script>

will write ie. 123 on my page in browser.

Can I get this integer or text 'document.write('integer')' to variable in another script? So it would be something like this:

<script landuage='javascript>
a=<script ... src='xxx.js'></script>;
a*=20;
document.write(a);
</script>

Please help me.

--
Mike J.
mi****@o2.pl

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.