All pastes #233950 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-11-02 06:18 UTC
rendered paste body
// this code basically just grabs an input element from a page and gets it's value ...
// it matches one input element only ... the function is called by pressing on a corresponding link 

<a href='#' 
 onclick="action_monitor('rMatchSent','teacher_id--recruiter_jobs_id');
           sndLead('sent_match_recruiter','teacher_id','recruiter_jobs_id');
           return false;" 
>    

function sndLead(action,teacher_id,job_id)
{

        http = createRequestObject();

        match_id = teacher_id+'-'+job_id ;

        teacher_match_notes = '' ;
        teacher_match_arr = new Array() ;
        teacher_match_arr=getElementsByClass(match_id) ;

        for( var i = 0 ; i < teacher_match_arr.length ; i++)
        {
                teacher_match_notes = teacher_match_arr[i].value;
        }

        alert(teacher_match_notes);

// problem is that I have, say, 2 input elements on the page each with a different class value.
// this code will return the contents of the when I press the button for a second time, regardless of 
// which of the two elements I call it on ...

// why does it output the value of the input on the second call only ?