CSS Style based on variable

Discussions about Mainlobby running on Apple mobile devices.
Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

CSS Style based on variable

Postby Clever1 » Thu Jan 20, 2011 7:37 pm

I would like to change the style (i.e. font color or image file) based on the status of a variable in MLServer being a 0 or a 1.

How do I do this with the iPhone web pages??

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: CSS Style based on variable

Postby CinemarDave » Thu Jan 20, 2011 7:55 pm

Have a little javascript routine run off setTimeout and check for the value of the server variable every so often. When the variable changes value have it set the class of the object you want to change to the new value. This will dynamically change the class as the variable changes.

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Re: CSS Style based on variable

Postby bigDvette » Fri Jan 21, 2011 12:33 am

Just add a little javascript to the end of the httpresponse javascript to check for your variable you are monitoring instead of setting a timer.

Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

Re: CSS Style based on variable

Postby Clever1 » Fri Jan 21, 2011 2:13 pm

Thankx... I figured it was probably something pretty easy like that and I should have just experimented...

If I understand the posts correctly the SetTimeout method looks as those it would update the web page in real time if I was on that page and the variable changed where the httpresponse method would only check the variable when the page loaded and not update real time is that correct??

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Re: CSS Style based on variable

Postby bigDvette » Fri Jan 21, 2011 2:31 pm

No not at all.

every time your screen polls the server (which it does continuously based on interval) it gets the variables and runs through the httpresponse code.

You are obviously seeing updates for other variables and that is the function that updates teh screen.

Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

Re: CSS Style based on variable

Postby Clever1 » Sat Jan 22, 2011 3:14 pm

Thankx...


Return to “MainLobby on iPhone, iPod Touch”

Who is online

Users browsing this forum: No registered users and 1 guest