Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Event trapping
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave Crash Dummy  
View profile  
 More options Apr 30 2012, 3:17 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Dave \"Crash\" Dummy" <inva...@invalid.invalid>
Date: Mon, 30 Apr 2012 15:17:08 -0400
Local: Mon, Apr 30 2012 3:17 pm
Subject: Event trapping
I have a table that contains 248 identical cells, differing only by the
enclosed text:

<td onMouseover="style.color='red'"
onMouseout="style.color='black'"
onClick="slashadd(this.innerText)">[string]</td>

The idea is to have the cell act like a hyperlink, with a "hover" color.
It works fine as shown, but is bulky. Is there some way I can use a single
script function to remotely capture and act on events in multiple cells?
--
Crash

Committed to the search for intraterrestrial intelligence.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mayayana  
View profile  
 More options Apr 30 2012, 4:55 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Mayayana" <mayay...@invalid.nospam>
Date: Mon, 30 Apr 2012 16:55:55 -0400
Local: Mon, Apr 30 2012 4:55 pm
Subject: Re: Event trapping
You can do something like this:

Sub DoHover()
   window.event.srcElement.style.color = "#FF0000"
End Sub

Sub UnHover()
   window.event.srcElement.style.color = "#000000"
End Sub

.....<TD onmouseover="DoHover()" onmouseout="UnHover()"......

  You can also do something like this:

Sub document_onmouseover()
  If window.event.srcElement.tagName = "TD" Then
     window.event.srcElement.style.color = "#FF0000"
  End If
End Sub

But personally I prefer to use classes and IDs:

Sub document_onmouseover()
  If window.event.srcElement.className = "TD248" Then
     window.event.srcElement.style.color = "#FF0000"
  End If
End Sub

Sub document_onmouseout()
  If window.event.srcElement.className = "TD248" Then
     window.event.srcElement.style.color = "#000000"
  End If
End Sub

.... with something like this:

<TABLE><TR><TD Class="TD248"></TD>
<TD Class="TD248"></TD>
<TD Class="TD248"></TD>
<TD Class="TD248"></TD>

--

"Dave "Crash" Dummy" <inva...@invalid.invalid> wrote in message
news:jnmofl$b7e$1@dont-email.me...
|I have a table that contains 248 identical cells, differing only by the
| enclosed text:
|
| <td onMouseover="style.color='red'"
| onMouseout="style.color='black'"
| onClick="slashadd(this.innerText)">[string]</td>
|
| The idea is to have the cell act like a hyperlink, with a "hover" color.
| It works fine as shown, but is bulky. Is there some way I can use a single
| script function to remotely capture and act on events in multiple cells?
| --
| Crash
|
| Committed to the search for intraterrestrial intelligence.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Crash Dummy  
View profile  
 More options May 1 2012, 7:01 am
Newsgroups: microsoft.public.scripting.vbscript
From: "Dave \"Crash\" Dummy" <inva...@invalid.invalid>
Date: Tue, 01 May 2012 07:01:52 -0400
Local: Tues, May 1 2012 7:01 am
Subject: Re: Event trapping

Thank you! I knew there was a way, but I was fuzzy on the nomenclature.
I've added your letter to my "snippets" collection.

In this instance, I could have used Plan B because it applied to all TD
elements, but opted for Plan C for added versatility. I also added this:

Sub document_onclick()
   If window.event.srcElement.className = "slash" Then
      call slashadd(window.event.srcElement.innerText)
   End If
End Sub

My table cells are reduced to <td class="slash">
--
Crash

English is not my native tongue; I'm an American.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »