묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
도와주세요~~ 체크박스를 찍으면 브라우저가 다운이 ㅡㅡㅋ
2005.04.05 02:11
아래와 같이 코딩을 하여 coldfusion으로 db와 연동을 했는데요
여기 체크박스를 하나 누르면 체크가 되지않고 자꾸 다운이 됩니다
데이타베이스가 조금 크긴한데 그것이 문제일까요?
혹시 해결법이 있으신 고수분들 부탁 드리겠습니다.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:16px; }
table{font-family:Arial, Helvetica, sans-serif; font-size:14px; }
.trigger{
cursor: pointer;
cursor: hand;
}
.branch{
display: none;
margin-left: 16px;
}
</style>
<script language="JavaScript">
var openImg = new Image();
openImg.src = "open.gif";
var closedImg = new Image();
closedImg.src = "close.gif";
function showBranch(branch) {
var objBranch =
document.getElementById(branch).style;
if(objBranch.display=="block")
objBranch.display="none";
else
objBranch.display="block";
}
function swapFolder(img) {
objImg = document.getElementById(img);
if(objImg.src.indexOf('close.gif')>-1)
objImg.src = openImg.src;
else
objImg.src = closedImg.src;
}
function checkalllocations(objone)
{
var objname;
var objvalue;
objname = objone.name;
if(objname == "selproduct")
{
objvalue = objone.value;
objvalue = objvalue.toString().substring(0, objvalue.length - 3);
}
else if(objname = "selfamily")
{
objvalue = objone.value;
}
for(i=0; i<document.forms("indexfrm").length; i++)
{
if(document.forms("indexfrm")[i].type=="checkbox")
{
if(document.forms("indexfrm")[i].value.indexOf(objvalue) > -1 && document.forms("indexfrm")[i]!=objone)
{
document.forms("indexfrm")[i].checked = objone.checked;
}
}
}
updatecheckboxes(objone);
}
function updatecheckboxes(clickobj)
{
if(clickobj.name != "selproduct"){return(0);}
var tmpvalue;
var tmpobj;
for(ucbi=0; ucbi<document.forms("indexfrm").length; ucbi++)
{
if(document.forms("indexfrm")[ucbi].type=="checkbox")
{
tmpobj = document.forms("indexfrm")[ucbi];
tmpvalue = document.forms("indexfrm")[ucbi].value.toString();
if(tmpobj.name == "selproduct")
{
//update family checkboxes & select all checkboxes
if(tmpvalue.substr(tmpvalue.length - 3, 3)=="all")
{
//check if all subitems are checked
tmpobj.checked = checksubitems(tmpvalue.substring(0, tmpvalue.length - 3));
}
}
else if(tmpobj.name == "selfamily")
{
//check if all subitems are checked
tmpobj.checked = checksubitems(tmpvalue);
}
}
}
}
function checksubitems(itemname)
{
var checkedstatus;
checkedstatus = true;
for(csii=0; csii<document.forms("indexfrm").length; csii++)
{
if(document.forms("indexfrm")[csii].type=="checkbox")
{
if(document.forms("indexfrm")[csii].value.indexOf(itemname) > -1)
{
if(document.forms("indexfrm")[csii].name!="selfamily" && document.forms("indexfrm")[csii].value.substr(document.forms("indexfrm")[csii].value.length - 3, 3)!="all")
{
checkedstatus = checkedstatus && document.forms("indexfrm")[csii].checked;
}
}
}
}
return(checkedstatus);
}
</script>
<title>Index Page</title>
</head>
<body>
<cfinclude template="header.cfm">
<p>Run a Forecast
<br>
Select Product(s) to Forecast</p>
<cfquery name="listAllItems" datasource="lemaitre05">
SELECT DISTINCT substring(itemnmbr,1,charindex('-',itemnmbr)) as fam, ITEMNMBR, ITEMDESC FROM IV00101 WHERE itmclscd = 'finished'
</cfquery>
<form name="indexfrm" action="forecast.htm" method="get">
<cfoutput group="fam" query="listAllItems">
<div class="trigger" onClick="showBranch('branch#replace(fam,"-","")#');swapFolder('folder#replace(fam,"-","")#')">
<img src="open.gif" border="0" id="folder#replace(fam,"-","")#">
#replace(fam,"-","")#<input name="selfamily" type="checkbox" value="#replace(fam,"-","")#" onclick="checkalllocations(this);"> Select Entire Family</div>
<span class="branch" id="branch#replace(fam,"-","")#">
<table><tr><td width="70"></td></td><td>All</td><td>USA</td><td>Ger</td><td>Jpn</td></tr></table>
<cfoutput>
<img src="doc.gif">#ITEMNMBR#
<input name="selproduct" type="checkbox" value="#ITEMNMBR#all" id="#ITEMNMBR#all" onclick="checkalllocations('#ITEMNMBR#usa, #ITEMNMBR#ger, #ITEMNMBR#usa'this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#usa" onclick="updatecheckboxes(this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#ger" onclick="updatecheckboxes(this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#jpn" onclick="updatecheckboxes(this);"><br>
</cfoutput>
</span>
</cfoutput>
<br>
<br>
*There are XX exceptions.
</p>
</p>
<input name="Run" type="submit" value="Run Forecast">
</form>
<p><a name="exc">The exceptions are...</a></p>
</body>
</html>
여기 체크박스를 하나 누르면 체크가 되지않고 자꾸 다운이 됩니다
데이타베이스가 조금 크긴한데 그것이 문제일까요?
혹시 해결법이 있으신 고수분들 부탁 드리겠습니다.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:16px; }
table{font-family:Arial, Helvetica, sans-serif; font-size:14px; }
.trigger{
cursor: pointer;
cursor: hand;
}
.branch{
display: none;
margin-left: 16px;
}
</style>
<script language="JavaScript">
var openImg = new Image();
openImg.src = "open.gif";
var closedImg = new Image();
closedImg.src = "close.gif";
function showBranch(branch) {
var objBranch =
document.getElementById(branch).style;
if(objBranch.display=="block")
objBranch.display="none";
else
objBranch.display="block";
}
function swapFolder(img) {
objImg = document.getElementById(img);
if(objImg.src.indexOf('close.gif')>-1)
objImg.src = openImg.src;
else
objImg.src = closedImg.src;
}
function checkalllocations(objone)
{
var objname;
var objvalue;
objname = objone.name;
if(objname == "selproduct")
{
objvalue = objone.value;
objvalue = objvalue.toString().substring(0, objvalue.length - 3);
}
else if(objname = "selfamily")
{
objvalue = objone.value;
}
for(i=0; i<document.forms("indexfrm").length; i++)
{
if(document.forms("indexfrm")[i].type=="checkbox")
{
if(document.forms("indexfrm")[i].value.indexOf(objvalue) > -1 && document.forms("indexfrm")[i]!=objone)
{
document.forms("indexfrm")[i].checked = objone.checked;
}
}
}
updatecheckboxes(objone);
}
function updatecheckboxes(clickobj)
{
if(clickobj.name != "selproduct"){return(0);}
var tmpvalue;
var tmpobj;
for(ucbi=0; ucbi<document.forms("indexfrm").length; ucbi++)
{
if(document.forms("indexfrm")[ucbi].type=="checkbox")
{
tmpobj = document.forms("indexfrm")[ucbi];
tmpvalue = document.forms("indexfrm")[ucbi].value.toString();
if(tmpobj.name == "selproduct")
{
//update family checkboxes & select all checkboxes
if(tmpvalue.substr(tmpvalue.length - 3, 3)=="all")
{
//check if all subitems are checked
tmpobj.checked = checksubitems(tmpvalue.substring(0, tmpvalue.length - 3));
}
}
else if(tmpobj.name == "selfamily")
{
//check if all subitems are checked
tmpobj.checked = checksubitems(tmpvalue);
}
}
}
}
function checksubitems(itemname)
{
var checkedstatus;
checkedstatus = true;
for(csii=0; csii<document.forms("indexfrm").length; csii++)
{
if(document.forms("indexfrm")[csii].type=="checkbox")
{
if(document.forms("indexfrm")[csii].value.indexOf(itemname) > -1)
{
if(document.forms("indexfrm")[csii].name!="selfamily" && document.forms("indexfrm")[csii].value.substr(document.forms("indexfrm")[csii].value.length - 3, 3)!="all")
{
checkedstatus = checkedstatus && document.forms("indexfrm")[csii].checked;
}
}
}
}
return(checkedstatus);
}
</script>
<title>Index Page</title>
</head>
<body>
<cfinclude template="header.cfm">
<p>Run a Forecast
<br>
Select Product(s) to Forecast</p>
<cfquery name="listAllItems" datasource="lemaitre05">
SELECT DISTINCT substring(itemnmbr,1,charindex('-',itemnmbr)) as fam, ITEMNMBR, ITEMDESC FROM IV00101 WHERE itmclscd = 'finished'
</cfquery>
<form name="indexfrm" action="forecast.htm" method="get">
<cfoutput group="fam" query="listAllItems">
<div class="trigger" onClick="showBranch('branch#replace(fam,"-","")#');swapFolder('folder#replace(fam,"-","")#')">
<img src="open.gif" border="0" id="folder#replace(fam,"-","")#">
#replace(fam,"-","")#<input name="selfamily" type="checkbox" value="#replace(fam,"-","")#" onclick="checkalllocations(this);"> Select Entire Family</div>
<span class="branch" id="branch#replace(fam,"-","")#">
<table><tr><td width="70"></td></td><td>All</td><td>USA</td><td>Ger</td><td>Jpn</td></tr></table>
<cfoutput>
<img src="doc.gif">#ITEMNMBR#
<input name="selproduct" type="checkbox" value="#ITEMNMBR#all" id="#ITEMNMBR#all" onclick="checkalllocations('#ITEMNMBR#usa, #ITEMNMBR#ger, #ITEMNMBR#usa'this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#usa" onclick="updatecheckboxes(this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#ger" onclick="updatecheckboxes(this);">
<input name="selproduct" type="checkbox" value="#ITEMNMBR#jpn" onclick="updatecheckboxes(this);"><br>
</cfoutput>
</span>
</cfoutput>
<br>
<br>
*There are XX exceptions.
</p>
</p>
<input name="Run" type="submit" value="Run Forecast">
</form>
<p><a name="exc">The exceptions are...</a></p>
</body>
</html>