Hi,

I'm writing the JS functions but I've get some errors from the JS console, so:


Code:
<script type="text/javascript">
function rounded(selector,bk,color){
	var el=document.getElementById(selector);
	addtop(el,bk,color);
	addbottom(el,bk,color);
}

function addtop(el, bk, color){
	var i;
	var cn="r";
	var d=document.createElement("b");
	d.className="rtop";
	d.style.backgroundColor=bk;
	for(i=1;i<=4;i++){
		var x=document.createElement("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
		d.appendChild(x);
	}
	el.insertBefore(d,el.firstChild); // line where console shows error
}

function addbottom(el,bk,color){
	var i;
	var cn="r";
	var d=document.createElement("b");
	d.className="rbottom";
	d.style.backgroundColor=bk;
	for(i=4;i>0;i--){
		var x=document.createElement("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
		d.appendChild(x);
	}
	el.appendChild(d,el.firstChild);
}
</script>
<script type="text/javascript">
window.onload=rounded("top","#000","#fff");
</script>
The console tells me that object "el" has no properties, anybody can help me?