Jump to content
xisto Community
takashiro1405241549

Javascript Problem

Recommended Posts

text=new Array ("不要让我自己发帖哦,你也要多发主题啊!","我们不是最大的犬中文站,但我们能做得更好!","或许很多人都只是匆匆过客,但是这里仍然会愿意你留下的脚印...","好怀念那段坐在电视机前的时光,等待《犬夜叉》的出现...","我们长大了,离童年渐渐远去,好想回到那个时候","某一天,当你想起《犬夜叉》的时候,就来时代を越える旅逛逛吧","曾经想过这个网站存在的意义,曾想放弃..而现在,我要努力留住这里","尽管SUNRISE停止了制作《犬夜叉》,但这个故事,有我们一起延续","时间让你渐渐离开了曾经的梦幻世界,偶尔曾经的画面划过眼前的时候,時代を越える旅在这里等你到来","穿越时空500年,妖怪纵横的战国时代,战国的世界里有明天","");[color="#FF0000"]if ((screen.width == 800)){	document.write(text[Math.floor(Math.random() * text.length)]);};[/color]

I just couldn't find out where is the problem. My screen width is 1024px, not 800! But the script still show the text. Or, there's any problem with my Browser?

Share this post


Link to post
Share on other sites
alert(screen.width);if ((screen.width == 800)){	document.write(text[Math.floor(Math.random() * text.length)]);}

You can try the above code and see what did it show in the message box. Alternatively, if you're using firefox, you can try to install firebug extension. It will ease you on debugging the problem. http://getfirebug.com/

You can even type in code like "screen.width" in the console and have the result return to you straight away. Must have for web developer

Share this post


Link to post
Share on other sites

Oh! Thanks! It shows 1024 in Internet Explorer, but shows 800 in Tencent Traveler! There must be somthing wrong with Tencent Traveller. Now it works well in IE.

Hehe, must have been an implementation problem, or lazy programmer, just assuming everyone's screen size is 800x600. :rolleyes:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.