Here's my code, I am sure there are lots of problems in it and any help is appreciated
<html>
<head>
<title> Card Stacking </title>
<script>
var t=0;
var cards = new Array();
var j=0;
function Card(name,address,work,home) {
this.name = name;
this.address = address;
this.workphone = work;
this.homephone = home;
}
function display(cards)
{
for (j in cards)
{
var dv = document.createElement('div');
id = "card" + j;
dv.setAttribute('id',id);
dv.style.position = absolute;
dv.style.left = 600+j*10;
dv.style.top = 100+j*10;
dv.style.zindex = j;
dv.innerHTML = "<table><tr><th style='background-color:blue; color:white;'>Business Card of "+ cards[j].name +
"<\/th><\/tr>" + "<tr><td rowspan='4'><b>Name: <\/b>"+cards[j].name+"<br><b>Address:
<\/b>"+cards[j].address+"<br><b>Work-Phone: <\/b>"+cards[j].workphone+"<br><b>Home-Phone: <\/b>"+card[j].homephone+"<br><\/td><\/tr>";
document.forms[0].appendChild(dv);
}
}
</script>
</head>
<body>
<form name="form1">
<p><b>Name: </b> <input type="text" size="20" name="fname" >
</p>
<p><b>Address: </b> <input type="text" size="10" name="address" >
</p>
<p><b>Work-Phone: </b> <input type="text" size="10" name="work" >
</p>
<p><b>Home-Phone: </b> <input type="text" size="10" name="home" >
</p>
<p><input type="button" value="Submit" onclick="cards.push(new Card(fname.value,address.value,work.value,home.value));">
<input type="reset" value="Reset">
<input type="button" value="Display" onclick="display(cards);"></p>
</form>
</body>
</html>

New Topic/Question
Reply



MultiQuote





|