shivapd1983
03-31-2006, 05:36 AM
I did use the " getElementById()" and the "appendChild()". The values I can see in the page but the values I have entered in the text filed does not flush out after clicking the submit button automatically. I am a newuser for the javaScript.Plz HELP me for getting the exct codes.I am giving the codes. So that one can understand.
I may loose the decorom of this forum because i am a new user so that I dont know got to control in the forum>hope no body willangery with me for this.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Help</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function addLi(obj,txt)
{
var li=document.createElement('li');
var txt=document.createTextNode(txt);
li.appendChild(txt);
obj.appendChild(li)
}
window.onload=function()
{
document.getElementById('goBut').onclick=function()
{
addLi(document.getElementById('list1'),document.getElementById('txt').value);
}
}
</script>
</head>
<body>
<input type="text" id="txt" />
<input type="button" id="goBut" />
<ul id="list1">
</ul>
</body>
</html>
I may loose the decorom of this forum because i am a new user so that I dont know got to control in the forum>hope no body willangery with me for this.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Help</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function addLi(obj,txt)
{
var li=document.createElement('li');
var txt=document.createTextNode(txt);
li.appendChild(txt);
obj.appendChild(li)
}
window.onload=function()
{
document.getElementById('goBut').onclick=function()
{
addLi(document.getElementById('list1'),document.getElementById('txt').value);
}
}
</script>
</head>
<body>
<input type="text" id="txt" />
<input type="button" id="goBut" />
<ul id="list1">
</ul>
</body>
</html>