Using custom data-attributes in html in onchange event
问题 The code below gives me an error "Fieldname not defined" when I am defining data-attributes and using them as parameters in a function. The update_person.php is updating a record in a database using the attributes in the input field. Is there a way to work around this? <!DOCTYPE html> <html> <head> <script> function update_person(str,fieldname,key,keyvalue) { if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+,