Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 30th, 2009, 01:21 PM
Authorized User
Join Date: Feb 2006
Location: jaipur, rajasthan, India.
Posts: 67
Thanks: 7
Thanked 0 Times in 0 Posts
Send a message via Yahoo to beetle_jaipur
Default How to change background color of text


i want to make a tool which can change text background color with mouse drag...using javascript

this is sample text.

i want to prepare a script. so that when i start dragging with mouse it changes the text color like when i start drag at s.. it immediately starts changing background color (yellow) of that selected text...

same as highlight tool.... but i do not want to click any button for it... just this tool should be available for text whenever i drag it anywhere on html/asp page..

any guideline/suggestion/resource are most welcome....
i am trying for last may days.. but could not find any appropriate method...

thanks for your consideration

best regards
ashok sharma
Old December 1st, 2009, 02:03 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default use jQuery

You can perform it using jQuery. Are you familiar with jQuery?
It is a javascript library that enables you to any visual tasks like dragging windows, made any picture rounded, etc.
for example notice following:
$("div > p").css("border","solid #0C0C0C 1px");
this means that change "border" propery of every "p" tag that is nested into a "div" tag, to "solid #0C0C0C 1px".

I put some files in my blog for you. by these you can learn to perform what you wanted and other things.





jquery.js in main javascript library. you can even get a link from Google servers.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change background color using CSS pigtail Javascript How-To 9 April 4th, 2010 11:13 AM
change color of background meena88 C# 2005 3 December 1st, 2009 04:48 AM
change background color of inputbox vickriz Javascript How-To 3 December 1st, 2009 02:22 AM
Change the background color of a msgbox nobreferreira VB.NET 2002/2003 Basics 3 October 28th, 2004 09:37 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.