Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building browser-specific CSS - need help FAST! 1

Status
Not open for further replies.

binarybabe

Programmer
May 13, 1999
11
US
Hi, all -<br>
<br>
Just dabbling in JS and having a *devil* of a time getting a simple little script to run. I have a class assignment due this week that needs to incorporate javascript and cascading style sheets. My URL for what I have so far is <br>
My goal for this script: if appName="Netscape" then load a certain set of CSS guidelines, otherwise default to a set of CSS guidelines written in HTML that will run on IE or NN.<br>
<br>
If anyone has a minute, can they view this script and give me some pointers? TIA,<br>
<br>
Binarybabe
 
Well first of all get rid of the "&lt;" in front of the var declaration, its giving errors. If you want to generate HTML on the fly, you need server-side scripts, like CGI or SSJS. I'm not sure you can do it with just JS and HTML.
 
I hate to intrude again, TheOrange. Please don't get me wrong. I'm all in favor of server side scripting, and love PHP, ASP, etc...<br>
<br>
But It IS possible to write HTML on the fly, either from within the current HTML page or by referring to a .js file.<br>
<br>
Simply put, the call 'document.write' can COMPLETELY rewrite the current HTML page depending on a variable. For an example of just this, visit one of my projects at - here you can enter a set of coordinates, (try LAT 28-32-21 and LONG 81-22-44) and the javascript application will match an array of coordinates HELD IN the .js file and rewrite the current page with the response.<br>
<br>
I do have a question, though. For BinaryBabe's application, is it possible that a server-side include could query the browser and then load the appropriate CSS text string? That option would be least taxing on both browser and server. has a really good intro to server side includes, even though it's aimed at Dreamweaver and the Apache web server. (don't know how much applies to IIS)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top