Question : Can I assign two different ID:s in the same <td>?

Can I assign two different ID:s in the same <td>? I need this to be able to print on screen with JavaScript both forname and surname on the same row, after each other, like this: Firstname_Lastname.

This is the code:

1:
2:
3:
4:
5:
6:
7:
  
<td id="Specforname", Specsurname"></td>
</tr>
</table>
<script>
document.getElementById("Specforname").innerHTML=window.opener.document.getElementById("forname").value;
document.getElementById("Specsurname").innerHTML=window.opener.document.getElementById("surname").value;


It doesn't work with above (having two id:s: Specforname and Specsurname). Is there another way to do this?

Answer : Can I assign two different ID:s in the same <td>?

Hi,

you no need 2 assign same id
but yes u can get ur result.
1:
document.getElementById("Specforname").innerHTML=window.opener.document.getElementById("forname").value+'_'+window.opener.document.getElementById("surname").value;;
Random Solutions  
 
programming4us programming4us