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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically choose a css

Status
Not open for further replies.

ronsig

Programmer
May 24, 2001
54
IL
Hi!

Is it possible to run a script which checks a field in a page as it loads, and then assign a certain css file to the page depending on that field's value?


10x

Ron
 
You can use JS for that also, mind telling us what you by 'checking the value of some field'??
If you mean assign one CSS class for <td> and another class for another <td>, you can do that without any kind of dynamic scritping...
Give us an example of what you mean and maybe we can help...[smile] I have not failed; I have merely found 100,000 different ways of not succeding...
 

okay, what I meant was:

When the user loggs on, I check a field value in the page e.g. the username supplied before, group membership in the company (this is a commercial product).

So, I need to set the css file I use for the page, but only after the page has finished loading.

Is this possible?

Ron
 
Hi There,

Have produced a website for a counterstrike clan and have used a script which allows you basically stack layers ontop of each other and display them based on an onclick event. I am trying to &quot;out-source&quot; to contaent of these layers using the ILayer tag. The problem i have is that the custom scroller that is used with the script (allows you to scroll the hidden content of the layer based off an onmouseover event) doesnt work in conjunction with the ilayers and i was hoping someone could either explain a better way to do this or to advise me how to fix it.

The site is found here


The page in question is the members page (see link in left nav bar), navigate to some other pages to see an example of the script and use the scroller at the bottom of the page.

Any help/advice/ideas will be appreciated.

Thanks

JaCkFrOsT
 
Ummm... how is the last post relevant to the subject of this thread?
 

I assume your doing the user identification server side so why not do the css nomination in server side script?


<%
If usergroup=&quot;somegroup&quot; then
%>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; ref=&quot;css/A.css&quot;>
<%
Else
%>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; ref=&quot;css/B.css&quot;>
<%
End If
%>
 

can't. The server-side application (c++) is fixed, only the UI scripting may be changed. Of course, I am able to place new .css/.js files on the server
 

Actually, I figured out a way, see below:

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>;
if(document.board.GroupName.value == &quot;admin&quot;)
document.write('<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;resources/console2.css&quot;></link>')
else
document.write('<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;resources/console.css&quot;></link>')
</script>

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top