Link to home
Start Free TrialLog in
Avatar of Guru Ji
Guru JiFlag for Canada

asked on

Concatenation In Javascript


I have a Function below

function see(sel,sel2)
{
      //alert(sel[sel.selectedIndex].text);
      alert(sel);
      alert(sel2);
      if (cell.selectedIndex > 0 )
      {      
            sel.originalcolor=sel.style.backgroundColor; sel.style.backgroundColor='#CCFFCC'
            sel2.originalcolor=sel2.style.backgroundColor; sel2.style.backgroundColor='#CCFFCC'
      }
      if (cell.selectedIndex == 0 )
      {      
            sel.originalcolor=sel.style.backgroundColor; sel.style.backgroundColor='#ECE9D8'
            sel2.originalcolor=sel2.style.backgroundColor; sel2.style.backgroundColor='#ECE9D8'

      }      
}

sel And sel2 are the id's of the table cell

I am calling this Function like this below

onchange="see('source','source2')"

How I make it To work To it accept source And source1 And use it instead of sel And sel2. I don't want to create more functions as I want to use one and pass different id's when calling the function
Avatar of gops1
gops1
Flag of United States of America image

where is the onchange called? Can you put the complete code atleast the flow
Avatar of Guru Ji

ASKER

<select onchange="see('source','source1')" size="1" class="style16" style="width: 197px" type="text" / size="20" name="num">
                  <option value="Please Choose">Please Choose</option>
              <option>1</option>
              <option>2</option>
              <option>3</option>
              <option>4</option>
              <option>5</option>
              <option>6</option>
            </select>
Avatar of Guru Ji

ASKER

actually here is the full code with id's too

        <td id="source" style="width: 89px; height: 26px"><strong><span class="style8">Source:</span></strong></td>
        <td id="source1" style="width: 197px; height: 26px">
        <select onchange="see('source','source1')" size="1" class="style16" style="width: 197px" type="text" / size="20" name="num">
                  <option value="Please Choose">Please Choose</option>
              <option>1</option>
              <option>2</option>
              <option>3</option>
              <option>4</option>
              <option>5</option>
              <option>6</option>
            </select>
ASKER CERTIFIED SOLUTION
Avatar of gops1
gops1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial