try:
Code:
function createnewseq(value) {
j = 0;
while (j<16) {
elOpt = document.createElement('div');
elOpt.id="smp_" + value+ '_' + j;
if (j <= 3 || j <= 11 && j > 7) {elOpt.className = 'step';} else {elOpt.className = 'stepon';}
elOpt.onclick=(function(val, j) {return function() {alert("smp_"+val+"_"+j);};})(value, j);
document.getElementById("seqrow_" + value).appendChild(elOpt);
j++;
}
}
also the script tags should be within the body tag:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.step { height:20px;border:1px solid #333333;width:13px;padding:3px;float:left;margin:2px;background-color:#FFFFFF;}
.stepon {height:20px;border:1px solid #333333;width:13px;padding:3px;float:left;margin:2px;background-color:#C1B9E3;}
.contnr {float:none;display:block;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body >
<div style="width:400px;"id="seq" name="seq"> <br /></div>
<input name="" type="button" value="add sampler" onclick="createnewrow();"/>
<label>
<input type="text" name="ploop" id="ploop" />
</label>
<script type="text/javascript">
function createnewseq(value) {
j = 0;
while (j<16) {
elOpt = document.createElement('div');
elOpt.id="smp_" + value+ '_' + j;
if (j <= 3 || j <= 11 && j > 7) {
elOpt.className = 'step';
} else {
elOpt.className = 'stepon';
}
elOpt.onclick=(function(val, j) {return function() {alert("smp_"+val+"_"+j);};})(value, j);
document.getElementById("seqrow_" + value).appendChild(elOpt);
j++;
}
}
function createnewrow() {
var randid =Math.floor(Math.random()*57489375);
sqrow = document.createElement('div');
sqrow.className = 'contnr';
sqrow.id="seqrow_" + randid;
document.getElementById("seq").appendChild(sqrow);
createnewseq(randid);
}
function playseq() {
for (k=0;k<16;k++) {
elOpt = document.createElement('div');
elOpt.className = 'step';
elOpt.id="smp_" + value;
document.getElementById("seqrow_" + value).appendChild(elOpt);
}
}
</script>
</body>
</html>
Bookmarks