SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot HotDog's Avatar
    Join Date
    May 2000
    Location
    Salt Lake City, UT
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want the site I'm designing to render different with different screen resolutions. I am confused on how IE access HTML tags through JavaScript. I can make the site work with NS using JASS, but I have been unsuccessful getting IE to work. This is what I have been playing around with. It doesn't work (of course), but it gives you an idea of what I'm trying to do. This example isn't exactly what I want it to do, I just through some code together to first try and get it to work.

    <HEAD>
    <title>test</title>
    </SCRIPT>
    <SCRIPT language="javascript1.2">
    <!--
    function window_format(font_size, background_color, header_size, header_color, page_margins) {
    this.fontsize = font_size;
    this.backgroundcolor = background_color;
    this.Color = header_color;
    this.margins = page_margins;
    }

    if (screen.width >= 1000)
    thisscreen = new window_format("24pt", "red", "36pt", "yellow", "1.0in");
    else if (screen.width >= 800)
    thisscreen = new window_format("20pt", "lightcoral", "28pt", "ivory", "0.5in");
    else
    thisscreen = new window_format("16pt", "beige", "20pt", "black", "10px");


    with (document.all.tags("Body").style) {
    backgroundColor=backgroundcolor;
    marginTop=margins;
    marginBottom=margins;
    marginRight=margins;
    marginLeft=margins;
    }
    document.all.tags("H1").fontSize.style=fontsize;
    document.all.tags("H1").color.style=color;
    alert("screen rez is;"+screen.height+"x"+screen.width)
    //-->
    </SCRIPT>
    </HEAD>
    <BODY id="test">
    <h1>Page header</h1>
    <P>
    This text will show in different sizes based
    on the size of the view screen when the page is opened.
    </P>
    </BODY>

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There is a series of excellent tutorials on this at www.bratta.com.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Magazine - MetaQuark Creations (Coming Soon)
    sitepoint@digitalmagician.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •