in this code when i click button it calls validatesave() function.this function calls getlabtestno.jsp it contains data in the form of xml .using tagname i will get the labtestid with an alert() message.it is perfectly executed in firefox nut not in chrome where i nedd to change the code please let me know,thanks in advance
<!DOCTYPE html>
<html>
<body>
<form id="myForm">
First name: <input type="text" name="fname"><br>
<td><input type="button" id="save" style="width: 100px; height: 30px;font-size: 14px;" accesskey="S" onclick="return validatesave()" value="S̲ave(Alt+s)"></button></td>
</form>
<script>
function validatesave()
{
alert("save is called");
var searchUrl = 'getlabtestno.jsp';
downloadUrl(searchUrl, function(data) {
var xml = parseXml(data);
var labtestid=0;
var markerNodes = xml.documentElement.getElementsByTagName("getIds");
labtestid = markerNodes[0].getAttribute("labtestid");
console.log(labtestid);
alert("Lab Test ID is "+labtestid);
document.getElementById('labtestno').value = labtestid;
document.getElementById('labtestno').readOnly = true;
console.log("count is"+labtestid);
});
}
</script>
</body>
</html>
No comments:
Post a Comment