Javascript Script execution problem

Hellfire1

Solid State Member
Messages
15
Sry I havent been active for a while, been busy with some stuff.
A friend of mine has ran across a Javascript fucntion, but it wont seem to work
Code:
<script type="text/javascript" src="stats_screen.asp?Screen_Size='document.write(getscreensize())'"></script>
Anyone know the problem? Help is greatly appreciated thank you!
 
I tried to debug this, but I'm missing your get screen size function!!

I imagine this works though, else you'd have posted the souirce here...

just for the sake of sanity though...

try to write
Code:
<script>
document.write(getscreensize());
</script>
in place of your current script, see if you get the expected result printed to the screen...

all I can suggest after that is that you try to put the variable you are returning from the function into a named variable...
 
Here is the Get Screen size funtion code
Code:
<script language="javascript" type="text/javascript">
<!--
function getscreensize() {
if (self.screen) {     // for NN4 and IE4
        width = screen.width
        height = screen.height
// Testing this first prevents firing the slow Java of NN4
}
else if (self.java) {   // for NN3 with enabled Java
       var jkit = java.awt.Toolkit.getDefaultToolkit();
       var scrsize = jkit.getScreenSize();       
       width = scrsize.width; 
       height = scrsize.height; 
}
else{
 width = height = '?' // N2, E3, N3 w/Java off, probably Opera and WebTV
}
document.write(width +"x"+ height)
}
<!--document.write(getscreensize())-->
// -->
</script>
 
document.write(width +"x"+ height)

not sure but I think that is the problem, you are writting the variable to the screen, try returning it from the function instead of document.write...

perhaps somebody else can give a little advice on this as well.
 
Back
Top Bottom