finaritwo
04-21-2006, 09:46 PM
just to let you know, i'm not in school, soo it's not homework, but i'm trying to learn javascript. i've come this far with my code, where i'm trying to create a custom object with four properties; firstname,lastname,DOB,salary,and a method called display,to display all four properties. then i need to create an instance of this object and prompt for each one of the four properties and then invoke the display method to display all properties in an HTML table like: firstname lastname DOB salary firstname entered lastname entered DOB entered salary entered can somebody please help me by looking at my code and to tell me where i'm going wrong. thanks.... <Html>
<Head>
<body>
<script type="Text/java script".
var First Name
var Last Name
var DOB
var Salary
function get_info()
{
First name=prompt("Enter the first name:","")
Last Name=prompt("Enter the last name:","")
DOB=prompt("Enter the data of birth:","")
Salary=prompt("Enter the salary:","")
disp_info()
}
function disp_info()
{
document.write("the first name is:" + First name +"<br>")
document.write("the last name is:" + Last Name +"<br>")
document .write("the salary is:" + Salary +"<br>")
document.write("the data of birth is:" + DOB +"<br>")
}
</script>
</Head>
<body>
<form>
<input type="button" onClick="get_info()" value="Get personal info">
</Form>
</body>
</Html>
<Head>
<body>
<script type="Text/java script".
var First Name
var Last Name
var DOB
var Salary
function get_info()
{
First name=prompt("Enter the first name:","")
Last Name=prompt("Enter the last name:","")
DOB=prompt("Enter the data of birth:","")
Salary=prompt("Enter the salary:","")
disp_info()
}
function disp_info()
{
document.write("the first name is:" + First name +"<br>")
document.write("the last name is:" + Last Name +"<br>")
document .write("the salary is:" + Salary +"<br>")
document.write("the data of birth is:" + DOB +"<br>")
}
</script>
</Head>
<body>
<form>
<input type="button" onClick="get_info()" value="Get personal info">
</Form>
</body>
</Html>