vendredi 15 mai 2015

issue for using javascript dynamic generate html code

I have javascript code like below, it used to dynamic generate html code.

"<td width=\"6%\">" +
"<a id=\"Pat_Meass_" +
i +
"\" onclick=\"populatePatMeass(" +
item.PAT_ID +
"," +
"tr_Pat_Id_" + i +
")\" onmouseover=\"\" style=\"cursor: pointer;\"" +
"title=\"SubFormIsNotEmpty\"" +
">" +
"PatMeas" +
"</a>" +
"</td>";

It generate html like below.

<td class="tableBody" width="6%">
<a id="Pat_Meass_0" title="SubFormIsNotEmpty" style="cursor: pointer; color: blue;" onmouseover="" onclick="populatePatMeass(37008,tr_Pat_Id_0)">PatMeas</a>
</td>

Acturally, the onclikc part, I would like it generate like below:

onclick="populatePatMeass(37008,"tr_Pat_Id_0")"

So, How to modify the code. Please help me out. Many thanks.




Aucun commentaire:

Enregistrer un commentaire