Javascript Problem

free web hosting
Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Javascript Problem

takashiro
CODE
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?

 

 

 


Reply

faulty.lee
CODE
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://www.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

Reply

takashiro
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.

Reply

faulty.lee
QUOTE(takashiro @ Dec 18 2007, 02:13 PM) *
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. tongue.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : javascript, problem

  1. Xhtml, Javascript, Css And Frames.
    (0)
  2. Ie Png Transparency Javascript?
    is there one? (3)
    im working on a new design for my website but i need to be able to have transparent pngs. its all
    fine in firefox and i think IE 7 it works, but IE 6, cos i no half the people that will be going on
    my site will use internet explorer 6. so basically, does anyone know any javascript that will make
    transparent PNG's work on internet explorer? id use gif but i dont just want a transparent
    background. also, id use CSS and just gifs but i need some of it to not be transparent, lol im
    fussy. so if you know anything please tell me, i gave up on javascript, its too hard. ....
  3. Can I Make A Webpage With Javascript
    title kinda says it all (9)
    ok, i plan to make a game, and i was wondering if i can make my webpage in javascript, i just
    started learning it for this massive enderour i plan to over take, and i wanted to know if it was
    possible lol. im also learning php and mysql. Thanks, Zemon1....
  4. Javascript Show / Hide Functions
    need some fine-tuning (3)
    Searching before posting my topic, i found this very helpful post. Javascript show + hide
    However, I'm still muddling around trying to fine tune it, and since i'm no good at coding,
    I'd appreciate any help. Using that example, how do I get the div text to be hidden on loading,
    rather than showing it all at page load. Also, is there a way to have the text change when clicked?
    so that for example, it would say "expand" when it's the small amount of text, and "collapse"
    when it's the full text? ....
  5. Where To Get Chat/Guestbook/Photo Album etc. Scripts?
    javascript and flah chat , guestbook, photo album and other (4)
    Post here some links where u can download flash or javascript chat , guestbook, photoalbum, forum
    ... etc ......
  6. JavaScript
    (1)
    Is there any place that i can get javascript from to use on my web page? Also are there any
    tutorials on how to write javascript. I have no idea how it works and would be greatful for any help
    that i can get. Thanx....
  7. Get Input From Html/txt File?
    with just html/css and maybe javascript? (2)
    I was just wondering if it's possible to retrieve text (and maybe images) from a .html or .txt
    file. So for example you get the header and footer from an external file. Is it possible with just
    html/css and maybe a little javascript or does it require server side scripting like php???
    -=jeroen=-....
  8. Hiding/showing Text On Click
    is it possible with css/javascript (2)
    Ok, I got an question: I want to make a site with a news box or something similar. It's gonna be
    a table with a small piece of text and an "read more" button. Now I want to make it so that if
    people click on the "read more" there will appear an other piece of text underneath it. How do I do
    this? thanks in advance, -=jeroen=-....
  9. Random Images On Eacht Pageload And Refresh.
    best in plain htlm or javascript (6)
    Im looking for somethin that puts a diffrent image for each pageload/refresh. And it should be
    something that dosent need any super server technolgys like php and mysql and all that stuff.
    something that is enough just on the page and finished.....
  10. Javascript Disables Css Link?
    (4)
    Here's the code I'm using for my javascript link I decided to add to a website I'm
    working on: Go Back The problem is that the css doesn't affect the javascript link. It
    displays as a plain blue underlined link. The stylesheet correctly renders regular links to other
    pages in the site, so the problem doesn't lie in my CSS coding. Thanks for the help.....
  11. What Is The Best Javascript Menu Builder?
    (7)
    I really need a free, cool and easy-to-integrate JAVASCRIPT menu builder for my new site. I mean
    free to use as in unlimitated use provided i link the producer's site to my menu. Anyway if
    someone knows anything pleas help. Thanks !!....
  12. Javascript
    Do you use javascript in your page ? (20)
    Hi , I begin to use Javascript recently. I understand very well and I'm already able to make
    little scripts. I like Javascript , it adds interactivity to the page. But sometimes , it is not so
    good ( Alerts while a page is loading ) So when do you use it , and when do you think Javascript is
    the most useful on a page. Thanks Mathieu....
  13. JavaScript template
    (1)
    to begin a javascript template, you will need to begin with this code.... <!--
    TemplateBeginEditable name="doctitle" --> Untitled Document <!-- TemplateEndEditable
    --> <!-- TemplateBeginEditable name="head" --> <!-- TemplateEndEditable
    --> ....
  14. Dynamic ASP Javascript
    (0)
    to begin a dynamic ASP Javascript you will need to begin with this code..... Untitled
    Document ....

    1. Looking for javascript, problem

Searching Video's for javascript, problem
advertisement




Javascript Problem



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE