I tried writing a few more test scripts and they all worked.... maybe
it was the script I was using that didn't work.
function alertSize() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else {
if( document.documentElement &&
( document.documentElement.clientWidth ||
document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else {
if( document.body && ( document.body.clientWidth ||
document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
}
}
window.alert( 'Width = ' + myWidth );
window.alert( 'Height = ' + myHeight );
}
I pulled it off a website. It's supposed to get the width and height
of a browser's window. I just did "return [myWidth, myHeight];" and it
didn't work. I tried to return a single value and that didn't work
either.
Maybe it also had to do with the DynAPI package I was using?
Javascript has changed so much since I last programmed in it....
Any comments + ideas would be greatly appreciated. Thanks to all those
who tried to help =)
Zhichun
sc*******@hotmail.com (Zhichun Pu) wrote in message news:<e8*************************@posting.google.c om>...
Hi guys,
I can't seem to get anything returned from functions.
If I use the <script src = ... > command, nothing works. But if I
define the functions locally within the file, then it works.
Something simple:
function abc() { return 99; }
If I tried to access this function by placing it inside a .js file,
and then including it, it returns "undefined". Everything else works
except for returned values...
If I define this function locally, it returns correctly the value of
99.
What is going on?? This is so weird.
Zhichun