hey, i started learning javascript programing n i wrote this simple code to test, it isn't working, here's the code :-

<script type="text/javascript">
{
	function mltest()
	{
	var fnmae=document.myForm.fName.value;
	var mName=document.myForm.mName.value;
	var lName=document.myForm.lName.value;
	var rtxt;
	rtxt="Your full name is : ";
	rtxt+=fName;
	rtxt+=mName;
	rtxt+=lName;
	var finalName="";
	document.myForm.finalName.value=rtxt;
	}
}
</script>
</head>
<body>
<center>
<form name=myForm>
Enter First name: <input type=text name=fName /><br />
Enter Middle name : <input type=text name=mName /><br />
Enter last name : <input type=text name=lName  /><br />
<input type=button value="Click to generate some custom text" onClick=mltest() /><br />
<input type=text name=finalName />
</form>
</center>
</body>

This program accepts a data using the input form and then gives an output in the last text form.

Can you tell why it isn't working?

Recommended Answers

All 2 Replies

Line 5, you declare variable 'fname', but in line 10 you use it as 'fName'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.