Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Best way to dynamically change background color of a span or div?

Reply
Thread Tools

Best way to dynamically change background color of a span or div?

 
 
Boonish
Guest
Posts: n/a
 
      09-29-2006
I have a page with a series of questions as links on the left, and
paragraphs of answers in a column to the right. What I'd like to have
happen is when the user clicks on a question to the left, the answer to
the right changes it's background color slightly to draw attention.

What's the easiest way of going about this? TIA.

 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      09-29-2006
In article <2006092916283116807-boog@felchcom>,
Boonish <(E-Mail Removed)> wrote:

> I have a page with a series of questions as links on the left, and
> paragraphs of answers in a column to the right. What I'd like to have
> happen is when the user clicks on a question to the left, the answer to
> the right changes it's background color slightly to draw attention.
>
> What's the easiest way of going about this? TIA.


One simple way, perhaps there are not too many questions?, is to
make each question link to another almost identical page except
one that has the answer to the right with a background that is
different to the 'previous'. Easy to do. Know what I mean?

Perhaps what you want is a hover effect though, because if the
answers are there staring at people to the right of each
question, why will they think it worth it to click? How to get
such a hover effect on the answer's and not the question's
background? Javascript perhaps, fancy this route?

--
dorayme
 
Reply With Quote
 
 
 
 
richard
Guest
Posts: n/a
 
      09-30-2006

"Boonish" <(E-Mail Removed)> wrote in message
news:2006092916283116807-boog@felchcom...
>I have a page with a series of questions as links on the left, and
>paragraphs of answers in a column to the right. What I'd like to have
>happen is when the user clicks on a question to the left, the answer to the
>right changes it's background color slightly to draw attention.
>
> What's the easiest way of going about this? TIA.


iframe? Place each response in a seperate page with changing backgrounds.

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-30-2006
Scripsit Boonish:

> I have a page with a series of questions as links on the left, and
> paragraphs of answers in a column to the right.


Why? For short questions and fairly short answers, such a tabular
presentation could work well. But then you wouldn't be asking, would you?

> What I'd like to have
> happen is when the user clicks on a question to the left, the answer
> to the right changes it's background color slightly to draw attention.


Why? The questions don't need to be links, since the answer is right there,
on the right of the question.

There's something here that you are not telling us. Like the URL.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Ben C
Guest
Posts: n/a
 
      09-30-2006
On 2006-09-29, Boonish <(E-Mail Removed)> wrote:
> I have a page with a series of questions as links on the left, and
> paragraphs of answers in a column to the right. What I'd like to have
> happen is when the user clicks on a question to the left, the answer to
> the right changes it's background color slightly to draw attention.
>
> What's the easiest way of going about this? TIA.


You can use the :active pseudo

e.g.:

..question:active .answer
{
background-color: yellow;
}

<div class="question">
What's the difference between a duck?
<div class="answer">
One of its legs is both the same
</div>
</div>

You could use <dl>, <dt>, <dd> etc for the questions and answers, and
style them appropriately.

This might mean changing how your content's organized a bit. If the
answers are highly dissociated from the questions in the document
structure, it might be easier to use JS and "onclick" events.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stéphane Klein Python 2 03-30-2010 12:35 AM
Re: I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stefan Behnel Python 0 03-29-2010 08:14 PM
Can span include span? Fulio Open HTML 5 06-26-2009 10:24 PM
Using JS to change color of the contents of a span tag Rob Javascript 3 11-14-2004 02:26 AM
DataGrid (body only) contained in <span>...</span> tags Dan Bishop ASP .Net Datagrid Control 2 06-07-2004 04:00 PM



Advertisments