Click here to Skip to main content
15,886,199 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionI don't know why css name is initialization. Pin
buffering833-Jul-11 17:30
buffering833-Jul-11 17:30 
AnswerRe: I don't know why css name is initialization. Pin
Gerben Jongerius3-Jul-11 22:00
Gerben Jongerius3-Jul-11 22:00 
QuestionCapturing the ID of an Element Pin
ASPnoob29-Jun-11 5:10
ASPnoob29-Jun-11 5:10 
AnswerRe: Capturing the ID of an Element Pin
Not Active29-Jun-11 5:44
mentorNot Active29-Jun-11 5:44 
GeneralRe: Capturing the ID of an Element Pin
ASPnoob29-Jun-11 6:38
ASPnoob29-Jun-11 6:38 
GeneralRe: Capturing the ID of an Element Pin
Not Active29-Jun-11 6:54
mentorNot Active29-Jun-11 6:54 
AnswerRe: Capturing the ID of an Element Pin
twseitex29-Jun-11 9:05
twseitex29-Jun-11 9:05 
AnswerRe: Capturing the ID of an Element Pin
AspDotNetDev29-Jun-11 10:17
protectorAspDotNetDev29-Jun-11 10:17 
Here is one way to do this:
HTML
<html>
<head>
  <title>Test CaptureID</title>
  <script type="text/javascript">
    function CaptureID(sender) {
      alert(sender.id);
      // Add your logic here.
    }
    function GetHandler_CaptureID(sender) {
      return function() {
        CaptureID(sender);
      }
    }
    window.onload = function() {
      var elementIDs = ["divHello", "divWorld"];
      var element;
      for (var i = 0; i < elementIDs.length; i++) {
        element = document.getElementById(elementIDs[i]);
        element.onclick = GetHandler_CaptureID(element);
      }
    };
  </script>
</head>
<body>
  <div>
    <div id="divHello" style="background-color: Green;">Hello</div>
    <div id="divWorld" style="background-color: Red;">World</div>
  </div>
</body>
</html>

Instead of having the list of ID's in advance, you could also scan the DOM and look for elements with an ID or by some other criteria. jQuery would make this exceptionally easy, like Mark was saying.
Driven to the ARMs by x86.

QuestionAndroid App Windows (NTLM) Authentication Pin
Colin Mullikin22-Jun-11 3:08
professionalColin Mullikin22-Jun-11 3:08 
GeneralRe: Android App Windows (NTLM) Authentication Pin
Colin Mullikin22-Jun-11 5:22
professionalColin Mullikin22-Jun-11 5:22 
Questiondocument.ready() and window.load() events don't fire Pin
benams21-Jun-11 4:41
benams21-Jun-11 4:41 
AnswerRe: document.ready() and window.load() events don't fire Pin
Not Active21-Jun-11 7:36
mentorNot Active21-Jun-11 7:36 
AnswerRe: document.ready() and window.load() events don't fire Pin
DaveAuld21-Jun-11 7:49
professionalDaveAuld21-Jun-11 7:49 
AnswerRe: document.ready() and window.load() events don't fire Pin
DaveAuld21-Jun-11 8:00
professionalDaveAuld21-Jun-11 8:00 
GeneralRe: document.ready() and window.load() events don't fire Pin
benams21-Jun-11 11:35
benams21-Jun-11 11:35 
AnswerRe: document.ready() and window.load() events don't fire [modified] Pin
Monjurul Habib21-Jun-11 12:12
professionalMonjurul Habib21-Jun-11 12:12 
AnswerRe: document.ready() and window.load() events don't fire PinPopular
AspDotNetDev21-Jun-11 15:56
protectorAspDotNetDev21-Jun-11 15:56 
GeneralRe: document.ready() and window.load() events don't fire Pin
vbmike22-Jun-11 9:48
vbmike22-Jun-11 9:48 
AnswerRe: document.ready() and window.load() events don't fire Pin
AspDotNetDev22-Jun-11 9:57
protectorAspDotNetDev22-Jun-11 9:57 
GeneralRe: document.ready() and window.load() events don't fire Pin
vbmike22-Jun-11 12:02
vbmike22-Jun-11 12:02 
Questionreading xml in jquery Pin
Ali Al Omairi(Abu AlHassan)19-Jun-11 23:06
professionalAli Al Omairi(Abu AlHassan)19-Jun-11 23:06 
AnswerRe: reading xml in jquery Pin
Ali Al Omairi(Abu AlHassan)19-Jun-11 23:35
professionalAli Al Omairi(Abu AlHassan)19-Jun-11 23:35 
Questionlearning Jquery Pin
benams14-Jun-11 22:41
benams14-Jun-11 22:41 
AnswerRe: learning Jquery PinPopular
Pete O'Hanlon14-Jun-11 22:57
mvePete O'Hanlon14-Jun-11 22:57 
AnswerRe: learning Jquery Pin
ajhampson16-Jun-11 5:29
ajhampson16-Jun-11 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.