A
AwefulService
Hi,
I attempt to create HTML ordered or unordered list function here.
Start with IE7...
function addList(obj,lt) {
var theBody = document.getElementById(obj);
var ul = document.createElement(lt);
theBody.appendChild(ul);
var li = document.createElement('li');
ul.appendChild(li);
var keyCode = event.keyCode;
// if (obj.type == "keydown" || obj.keyCode == 13)
if (keyCode == 13 || document.onkeypress) {
theBody.ul.appendChild(li);
return false;
}
}
<form action="" method="post">
Data entry:</br>
<textarea name="stuff" cols="60" rows="8"></textarea><br/>
<input type="button" value="Add unordered list"
onClick="addList('stuff','ul');"><br/>
<input type="button" value="Add ordered list"
onClick="addList('stuff','ol');"> <br/>
<input type="reset" value="reset">
</form>
What am I doing wrong?
Thanks.
I attempt to create HTML ordered or unordered list function here.
Start with IE7...
function addList(obj,lt) {
var theBody = document.getElementById(obj);
var ul = document.createElement(lt);
theBody.appendChild(ul);
var li = document.createElement('li');
ul.appendChild(li);
var keyCode = event.keyCode;
// if (obj.type == "keydown" || obj.keyCode == 13)
if (keyCode == 13 || document.onkeypress) {
theBody.ul.appendChild(li);
return false;
}
}
<form action="" method="post">
Data entry:</br>
<textarea name="stuff" cols="60" rows="8"></textarea><br/>
<input type="button" value="Add unordered list"
onClick="addList('stuff','ul');"><br/>
<input type="button" value="Add ordered list"
onClick="addList('stuff','ol');"> <br/>
<input type="reset" value="reset">
</form>
What am I doing wrong?
Thanks.