Forum Archive

Go Back   3D Realms Forums > General Topics > Programming Forum
Blogs FAQ Members List Social Groups Calendar Mark Forums Read

Notices

 
 
Thread Tools
Old 08-02-2007, 06:20 AM   #1
Samji

Samji's Avatar
Change background color of selected text
I am trying desperately to change the background color of a DOM (text) selection object in JavaScript.

This syntax does not work:

Code:
element.style.backgroundColor = "#nnnnnn";
I think that's because the selection object isn't in the node tree or whatever. Any ideas how I can color a selection background color red or whatever.

Thanks.
__________________
Sam's Py
Samji is offline  
Old 08-03-2007, 07:12 AM   #2
NetNessie

NetNessie's Avatar
Re: Change background color of selected text
Unless I too am missing something, your code should work as you want it.

The only reason why it would not be working is if element is not actually a HTML element object.

What exactly do you mean by "DOM (text) selection object"?
__________________
Ink Grass LazyMoon Photography
"Say something wise, and your name will be remembered forever." - Anonymous
NetNessie is offline  
 

Bookmarks

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

Forum Jump


All times are GMT -6. The time now is 07:10 AM.

Page generated in 0.11756897 seconds (100.00% PHP - 0% MySQL) with 18 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.

Website is 1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.