473,660 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any way to achieve this using only stylesheets (no Javascript)?

I have a line of text for which I want each word to become highlighted
(change background color) when the mouse cursor hovers over it, but
with one catch: when hovering over a word, it should highlight not only
itself but also every word following it until the end of the sentence.
So far, I have only been able to do this through Javascript onMouseOver
and onMouseOut events, identifying each word by an 'id' attribute and
changing its background color accordingly. All this makes the HTML
quite lengthy, and I was wondering if there would be a cleaner way to
do this using only CSS?
Thanks

Jan 5 '07 #1
1 1337

da********@gmai l.com wrote:
So far, I have only been able to do this through Javascript onMouseOver
and onMouseOut events,
Sounds reasonable to me. I don't think CSS would ever be able to do
this and JS is a perfectly reasonable solution.
identifying each word by an 'id' attribute
Sounds like you need some smarter JS. Don't pass an element's id into
your event handler, use the JS event object that already exists and
represents the source of the event. From this you should be able to
access the DOM and traverse it as needed, without needing to set
explicit ids in the HTML.

Jan 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2120
by: fad | last post by:
How can I create a database access using asp+javascript withen the code?Is there (createdatabase)?If yes how can we use it? thanks for all -- fad ------------------------------------------------------------------------ Posted via http://www.codecomments.com
1
2398
by: ritskits | last post by:
I have the dropdownlist that is populated when the form is loaded. I have the button that opens search child window using the modalwindowdialog and it returns the value that I want to add to the dropdownlist on the parent window using the javascript as there will not be any event fired when the childwindow is closed. function GetMeds() { var MedsString = window.showModalDialog("SearchColor.aspx", window, "dialogHeight: 700px;...
2
1024
by: Iams | last post by:
How do I set up in a style sheet what format I want to use for various controls, such as a drop down list? The format is not following the body font, nor tables (which the ddl's are in), nor even a grid, which some of them are in. Thanks.
1
12778
by: bill | last post by:
I need to be able to dynamically add items to a <asp:listbox> (or HTML <select runat=server>) using clientside javascript, and retrieve the items when the page is posted back. I use this code to add the option to the listbox. It works for <select> or <asp:listbox> controls. var opt = document.CreateElement("OPTION"); opt.text = "test"; opt.value="test";
17
121734
by: kartheek | last post by:
hi friends, can any one out here help me by giving me the code to connect to an MSACCESS database using javascript.
3
3460
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I want to extract all the tracks from a specific CD. Right now, im using an array to stock all the data but its just a question of time before everything blows up because of the size of the array. Thats why im want to use an XML file (later i will...
5
3649
by: lilOlMe | last post by:
I have an extern JavaScript file I've called "Utils.js". It will eventually hold all of the common JavaScript functions used throughout the ASPX pages that make up my website. Right now this file contains one JavaScript function. When I add the JavaScript function using Me.Page.ClientScript.RegisterStartupScript(Page.GetType, "myFunction", stringBuilderContainingMyScript.ToString()) I am able to use my function and everything works...
3
5768
by: farukcse | last post by:
Hi, Can any one tell me how to assign a php variable value using ajax / javascript? Regards, Faruk Chowdhury
6
4943
by: kiranbabu | last post by:
how to rotate an image using html/javascript
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.