How can I obtain the input value of the tr row clicked by the mouse through JS? The first record is always obtained ....... JScriptcodefunctionpopUserDetail (x) {varpopUp = document. getElementById (& quot JS get the input value in the loop table
How can I obtain the input value of the tr row clicked by the mouse?
The first record is always obtained .......
JScript code
function popUserDetail(x){ var popUp = document.getElementById("popUserDetail"); var h = (x.rowIndex)*20; popUp.style.top= 25 + h + "px"; popUp.style.left="142px"; popUp.style.width="200px"; popUp.style.height="100px"; popUp.style.visibility="visible"; var customerId = document.getElementsByTagName("input")[0].value; alert (customerId); }
PHP code
While ($ records = mysql_fetch_array ($ rows) {$ arr = ct ($ records ['uniqueid']); $ fileLastUploadTime = $ arr [1]; print' '. St ($ records ['lastt'], $ fileLastUploadTime ).' '. $ Records ['barname'].' '. $ Records ['lastlogin'].' '. Date ("Y-m-d H: I: s", $ arr [1]).' '. $ Records ['endtm'].' '. $ Arr [0].' '. $ Records ['version'].' ';} Print'
Customer ID: |
|
Customer address: |
|
Initial login: |
Backup cycle: |
Contact QQ: |
Contact number: |
------ Solution --------------------
What is your sentence?
Var customerId = document. getElementsByTagName ("input") [0]. value;
If the index is 0, it will always be the first.
Changed:
Var customerId = document. getElementsByTagName ("input") [x. rowIndex]. value;
Try It Again!
------ Solution --------------------
Var customerId = document. getElementsByTagName ("input") [0]. value; incorrect
------ Solution --------------------
Discussion