hi,
i am new to js and html.
i need a help to solve this prob..
i need the output as the values entered in form to alert.by using string with loop.i tried following code...can anyone help in this
i am new to js and html.
i need a help to solve this prob..
i need the output as the values entered in form to alert.by using string with loop.i tried following code...can anyone help in this
Code:
<html>
<head>
<title>elements in a form</title>
<script type="text/javascript">
function processFormData()
{
var len= document.getElementsByTagName('name');
var str1=null;
for(i=0;i<=len;i++)
{
var str=(subscribe.name[i].value);
str=str1+str;
}
alert(str);
}
</script>
</head>
<body>
<form name ="subscribe" >
<p><label for="name">Your Name: </label><input type="text" name="name" id="txt_name" value="name"></p>
<p><label for="email">Your Email: </label><input type="text" name="email" id="txt_email" value="mail"></p>
<input type="button" value="submit" onclick="processFormData()">
</form>
</body>
</html>
Comment