Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - VB.NET: dynamic css

Reply
 
Old 02-06-2009   #1 (permalink)
Mike J.


 
 

VB.NET: dynamic css

Hi, I have a web project in VB.NET 2005. I want to detect the user's web
browser and version, then make a change to the CSS based on which version of
IE, 6 or 7. I have a javascript function pageLoad that works to detect the
version but I'm still trying to get the css changed from that point. Does
anybody here know how to do this?

My System SpecsSystem Spec
Old 02-07-2009   #2 (permalink)
Gregory A. Beamer


 
 

Re: VB.NET: dynamic css

VB.NET is inconsequential here, as you are doing this in JavaScript. Your
stylesheet probably looks something like this:

<link id="cssFile" href="ie.css" type="text/css" rel="stylesheet">

You then have a test that says it is Firefox, not IE. Just do this:

document.getElementById('cssFile').href = 'firefox.css';

I typed this in freehand, so fix it if necessary. The basic concept works.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*********************************************
| Think outside the box |
*********************************************
"Mike J." <MikeJ@xxxxxx> wrote in message
news:0F6EB95D-DA65-4B45-8593-2430AE317190@xxxxxx
Quote:

> Hi, I have a web project in VB.NET 2005. I want to detect the user's web
> browser and version, then make a change to the CSS based on which version
> of
> IE, 6 or 7. I have a javascript function pageLoad that works to detect
> the
> version but I'm still trying to get the css changed from that point. Does
> anybody here know how to do this?
My System SpecsSystem Spec
Old 02-10-2009   #3 (permalink)
Andrew Morton


 
 

Re: VB.NET: dynamic css

Mike J. wrote:
Quote:

> Hi, I have a web project in VB.NET 2005. I want to detect the user's
> web browser and version, then make a change to the CSS based on which
> version of IE, 6 or 7. I have a javascript function pageLoad that
> works to detect the version but I'm still trying to get the css
> changed from that point. Does anybody here know how to do this?
No need: you can make IE do things that other browsers will ignore without
fiddly CSS hacks:

http://www.quirksmode.org/css/condcom.html

So if the user has Opera set to pretend to be IE in the user-agent string,
it still works.

Andrew


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Dynamic statements? PowerShell
Dynamic Backgrounds gone Live Messenger
Dynamic .vhd expansion. Virtual Server
dynamic disks Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46