29 users online (1 members and 28 guests)  


  Results 1 to 5 of 5

Related

  1. Replies: 2
  2. Replies: 7
  3. document.write question    Forum: Javascript Forum
    Replies: 5
  4. Javascript document.write problems    Forum: Javascript Forum
    Replies: 3
  1. #1
    Glenvern's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2002
    Location
    Norfolk, UK.
    Posts
    112

    Question document.write() query

    I am using a document.write() script...
    I am using it to write to differing screen sizes -
    ------------------------------------------------------
    <script language="JavaScript">
    if (screen.width <= 640) {
    document.write("etc. etc. etc.
    }
    else if (screen.width <= 800) {
    document.write("etc. etc. etc.
    }
    ------------------------------------------------------
    This works fine but I have to have all the code on one line otherwise I get a script error, how do I change this so I can read it like a page..?

    Or am I using the wrong script..?
    Glenvern

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: document.write() query

    Hi,

    Unfortunately, thats the way JavaScript works. Not much you can do about it.

    However, you may be able to move away from JavaScript completely by using percentage widths in your stylesheet instead of this method, then stuff should fit either way.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Glenvern's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2002
    Location
    Norfolk, UK.
    Posts
    112

    Re: document.write() query

    Thanx for the reply, it's as I thought...

    Percentages work ok with images but I don't know how to do it with fonts. I just can't get my head round CSS & Style sheets..

    Trouble is I have never seen a completed style sheet that covers all the bells and whistles,
    if you know of one I can look at I may be able to make some sense of it..
    Glenvern

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: document.write() query

    Have you tried -

    http://css.somepeople.net/
    http://www.w3schools.com/css/default.asp
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    Glenvern's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2002
    Location
    Norfolk, UK.
    Posts
    112

    Re: document.write() query

    Great CSS sites but neither of them tell me how to write a style sheet -

    As I said I would like to see a page already written, these websites just give you a variety of lines of syntax that go into a style sheet..

    Do I use an HTML template and write between the <body> tags or what?

    What do I call it and where do I put it when it's written.?

    How/where do I refer to it if/when it's uploaded.?

    Finding the CSS references is the easy bit, where and how to use them is my problem..

    And I still couldn't find any syntax to change the font to match the screen size...

    Doh!!
    Last edited by Glenvern; 05-07-2005 at 02:40 AM.
    Glenvern



Tags for this Thread