I need quick help, its urgent for my job, pls help me.
I need to change the font color, font size & font face of some text assigned in a div. To do so I have a form select option menu at the top, adn below the menu three's 3/4 divs with some text. I need to change text properties of the div from select menu, and the page must not refresh. Its actually a little version of text editor.
I'll be glad if someone solves it ASAP.

Recommended Answers

All 5 Replies

You need to look into JavaScript and DOM. Give you DIV an id and then you can import the DIV as an object with:

div = document.getElementById('div_id');

Then you can change the styles with:

document.getElementById('div_id').color = '#999999';

See this page for help with DOM and JavaScript.

But not forgetting ".style"

document.getElementById('div_id').style.color = '#999999';

But I'm sure FlashCreations knows that really.

Koyel555, I think you might need to give your controls some more thought. You say there are several divs and several factors (font, color, size) but you only mention one control - a select menu.

It depends exactly what you want but you may need one menu per div, and possibly one menu per factor per div.

Another way of diing it would be to have a single set of controls (one per factor) and a way to signify an "active" div on which they operate - one div at a time.

It is certainly hard to see how a single select menu would offer adequate control.

Airshow

But not forgetting ".style"

document.getElementById('div_id').style.color = '#999999';

But I'm sure FlashCreations knows that really.

Koyel555, I think you might need to give your controls some more thought. You say there are several divs and several factors (font, color, size) but you only mention one control - a select menu.

It depends exactly what you want but you may need one menu per div, and possibly one menu per factor per div.

Another way of diing it would be to have a single set of controls (one per factor) and a way to signify an "active" div on which they operate - one div at a time.

It is certainly hard to see how a single select menu would offer adequate control.

Airshow

Ahh....yes! I clumsily forgot to place .style before the .color or any other property. :D Wouldn't be the first time... ;)

Wouldn't be the first time... ;)

Same here. Easily done.

Airshow

Very easily done!
Anyhow, if all of your problems have been solved and all questions answers I ask that you mark this thread as solved!! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.