Javascript question

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi All:

FP2003

Wonder if someone could take a look at some javascript I am trying to use in
a web page, where I am attempting to call a javascript include based on
screen resolution:

<script language="javascript" type="text/javascript">
var sWidth = screen.width
if(sWidth==800){'document.write('<script language=javascript
src=incNav.js'></script>');
}
else{
document.write("too bad")
</script>

Seems like I have done this before sometime, but I can't seem to get this
syntax to work.

TIA

Steve G
 
Why do this? And you understand that screen resolution only determines the
maximum width of my browser viewport, right? You still have no idea what
those dimensions are when you look at resolution - they may be significantly
narrower. For example, on my 1280px wide screen, I am rarely looking at a
browser viewport wider than 720px.
 
Yes, I am aware of what you are saying regarding window width.

I am developing a site in ASP. When I develop a site, I try to set it up so
that it will look approximately the same at most resolutions.. controlling
text size and images loaded by way of a combination of javascript, css, and
using different sized images depending on resolution.

In this instance, I need to bring in an include file, however, you can't use
the <!--some content--> in java script, so I am attempting to loan it based
on converting it to a .js file, then bringing it in by way of the javascript
I showed below.

Steve G

Why do this? And you understand that screen resolution only determines the
maximum width of my browser viewport, right? You still have no idea what
those dimensions are when you look at resolution - they may be significantly
narrower. For example, on my 1280px wide screen, I am rarely looking at a
browser viewport wider than 720px.
 
Back
Top