Click here to Skip to main content
15,884,298 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: How do I hide a column using JQuery? Pin
AspDotNetDev8-May-13 8:17
protectorAspDotNetDev8-May-13 8:17 
GeneralRe: How do I hide a column using JQuery? Pin
Jasmine25018-May-13 8:42
Jasmine25018-May-13 8:42 
GeneralRe: How do I hide a column using JQuery? Pin
Ilan Firsov8-May-13 19:51
Ilan Firsov8-May-13 19:51 
QuestionHTML Table to Export To Excel Pin
shreeniwas kushwah6-May-13 20:06
shreeniwas kushwah6-May-13 20:06 
AnswerRe: HTML Table to Export To Excel Pin
Dennis E White7-May-13 5:18
professionalDennis E White7-May-13 5:18 
QuestionCode translate from AS to Delphi Pin
isaev.mail6-May-13 0:28
isaev.mail6-May-13 0:28 
AnswerRe: Code translate from AS to Delphi Pin
isaev.mail12-May-13 21:12
isaev.mail12-May-13 21:12 
QuestionUsing this.id Pin
ASPnoob5-May-13 7:40
ASPnoob5-May-13 7:40 
Hi all,
I am trying to pass the value inside of "this.id" from one function to another function but it's not working. Basically I am trying to grab the id of a thumbnail image which is inside anchor tags, by using "this.id" when they are clicked. Then I would like to display data related to the clicked thumbnail which are stored in an array, using innerHTML. I am using the AddEventListener property inside the script tags to listen for the onclick event thus I do not have the onclick property on my webpage. The following are my functions inside the script tags:
JavaScript
var songTitle =new Array("Title1", "Title2");
  function AddListeners()
    {
     if(window.addEventListener)
      {
       document.getElementById('A1').AddEventListener("click",Display_Info,false);
       document.getElementById('A2').AddEventListener("click",Display_Info,false);
       document.getElementById('A3').AddEventListener("click",Display_Info,false);
      }
     else if(window.attachEvent)
      {
       document.getElementById('A1').attachEvent("onclick",Display_Info);
       document.getElementById('A2').attachEvent("onclick",Display_Info);
       document.getElementById('A3').attachEvent("onclick",Display_Info);
      }
     }      

      function imgClicked(x)
      {
          var idClicked = x; //get thumbnail id      
          var newID = idClicked.substring(0,1); //subtract first character of thumbnail id        
          var convertedID = ParseInt(newID,10); //convert id to integer         
          return convertedID;          
      }
   
      function Display_Info()//passing in Parameter            
      {                 
          var A= this.id;
          var picID = imgClicked(A);
          document.getElementById('Title').innerHTML= songName[picID];                  
      }   

The following are anchor tags inside the body of my webpage:
HTML
<a href="#self"><img src=image1" id="A0"></a>
<a href="#self"><img src=image2" id="A1"></a>
<a href="#self"><img src=image3" id="A2"></a>

Please take a look to see why my script is not working. Any help is greatly appreciated, thanks in advance.
AnswerRe: Using this.id Pin
twseitex5-May-13 7:49
twseitex5-May-13 7:49 
GeneralRe: Using this.id Pin
ASPnoob5-May-13 8:01
ASPnoob5-May-13 8:01 
AnswerRe: Using this.id Pin
dusty_dex6-May-13 8:26
dusty_dex6-May-13 8:26 
QuestionSend data with XMLHttpRequest Pin
Mohammad Hussein Fakhravari3-May-13 22:40
Mohammad Hussein Fakhravari3-May-13 22:40 
QuestionRe: Send data with XMLHttpRequest Pin
Sandeep Mewara4-May-13 0:50
mveSandeep Mewara4-May-13 0:50 
AnswerRe: Send data with XMLHttpRequest Pin
Mohammad Hussein Fakhravari4-May-13 11:08
Mohammad Hussein Fakhravari4-May-13 11:08 
NewsForm builder using jQueryUI and Bootstrap Pin
Anup Shinde3-May-13 2:10
Anup Shinde3-May-13 2:10 
GeneralRe: Form builder using jQueryUI and Bootstrap Pin
dusty_dex3-May-13 4:56
dusty_dex3-May-13 4:56 
GeneralRe: Form builder using jQueryUI and Bootstrap Pin
Anup Shinde3-May-13 5:05
Anup Shinde3-May-13 5:05 
GeneralRe: Form builder using jQueryUI and Bootstrap Pin
Anup Shinde3-May-13 5:06
Anup Shinde3-May-13 5:06 
GeneralRe: Form builder using jQueryUI and Bootstrap Pin
Dennis E White3-May-13 5:59
professionalDennis E White3-May-13 5:59 
Questionloading image before loading video on page Pin
meena mehra30-Apr-13 2:17
meena mehra30-Apr-13 2:17 
AnswerRe: loading image before loading video on page Pin
twseitex5-May-13 7:59
twseitex5-May-13 7:59 
QuestionI cant download the source code in the following projet Pin
Baturay E.H.AHMAD27-Apr-13 9:17
Baturay E.H.AHMAD27-Apr-13 9:17 
AnswerRe: I cant download the source code in the following projet Pin
NotPolitcallyCorrect27-Apr-13 12:03
NotPolitcallyCorrect27-Apr-13 12:03 
QuestionjQuery Question Pin
BobInNJ26-Apr-13 13:05
BobInNJ26-Apr-13 13:05 
AnswerRe: jQuery Question Pin
dusty_dex26-Apr-13 13:28
dusty_dex26-Apr-13 13:28 

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.