JavaScript Object Part – 2
Full Stack Web Development Courses with Real-time projects Start Now!!
Program 1
<!DOCTYPE html>
<html>
<body>
<script>
var emp={
eid:101,
ename:'Rajesh Sharma',
edept:'IT',
esalary:70000,
qf:['10th','12th','BTech','MTech']
}
var emp1={
eid:102,
ename:'Amit Verma',
edept:'HR',
esalary:65000,
qf:['10th','12th','BTech','MBA']
}
function display()
{
document.writeln("<center>")
document.writeln("<table border=1>")
document.writeln("<tr><th>ID</th><th>NAME</th><th>Dept</th><th>Salary</th><th>Qualificaation</th></tr>")
document.writeln("<tr>")
document.writeln("<td>"+emp.eid+"</td>")
document.writeln("<td>"+emp.ename+"</td>")
document.writeln("<td>"+emp.edept+"</td>")
document.writeln("<td>"+emp.esalary+"</td>")
document.writeln("<td>"+emp.qf+"</td>")
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td>"+emp1.eid+"</td>")
document.writeln("<td>"+emp1.ename+"</td>")
document.writeln("<td>"+emp1.edept+"</td>")
document.writeln("<td>"+emp1.esalary+"</td>")
document.writeln("<td>"+emp1.qf+"</td>")
document.writeln("</tr>")
// docuemtn.writeln(emp)
console.log(emp)
document.writeln("</table>")
document.writeln("</center>")
}
</script>
<center>
<form>
<input type="button" value="Click Here" onclick="display()" on>
</form>
</center>
</body>
</html>
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

