i wanted to print name which is given by user dynamically.
that is "myMother.first name".but it does not work any more.please help me solve this.
that is "myMother.first name".but it does not work any more.please help me solve this.
Code:
<body>
<p>heyy</p>
First name:<input type="text" id="fname" onclick="callme()">
<script type="text/javascript">
<!--
function person(firstname)
{
this.firstname=firstname;
}
function callme()
{
var n=document.getElementById("fname").value;
myMother=new person(n);
}
var d=document.getElementById("demo");
document.write("First name is:" +d.innerHTML=myMother.firstname);
//-->
</script>
<p id="demo"></p>
</body>
Comment