S
Sharon
Hi y'all,
I'm trying to create a customized context menu using the DHTML Popup
object. The HTML that makes up the body of the popup is created in a
variable named 'popCode'. Works like a charm, except when I call a
function in an onclick it gives an 'object expected' error. Here's the
popup function (dopopup) and the function I'm calling (renderData):
function dopopup(Value,Field,x,y) {
popCode='';
popCode+='<html>\n<head>\n';
popCode+='<script type="text/javascript"
src="xTable.js"><\/script>\n';
popCode+='<\/head>\n<body>\n';
popCode+='<table style="border:1pt solid #808080" bgcolor="#CCCCCC"
width="140" height="220" cellpadding="0"
cellspacing="1" oncontextmenu=\"return false;\">\n';
popCode+='<STYLE TYPE="text/css">\n';
popCode+='td {font-family: Tahoma, Arial, Helvetica,
sans-serif;font-size: 8pt;font-style: normal;border:1pt solid
#CCCCCC; background:#CCCCCC;}\n';
popCode+='.over {background:#3366AF;color:#FFFFFF;border:1pt solid
#737B92}\n';
popCode+='<\/STYLE>\n';
popCode+='<script type="text/javascript"
src="xTable.js"><\/script>\n';
popCode+='<tr><td'
popCode+=' onMouseover="className=\'over\';"
onMouseout="className=\'\';" onClick="alert(\'' + Value +'\');">';
popCode+='Filter op: '+Field+' is '+Value+'</td></tr>\n';
popCode+='<tr><td';
popCode+=' onMouseover="className=\'over\';"
onMouseout="className=\'\';" onClick="renderData(\'' + Field
+'\');">';
popCode+='Filter op: '+Field+' is '+Value+'</td></tr>\n';
popCode+='</table>\n';
popCode+='<\/body>\n<\/html>\n';
var oPopupBody = oPopup.document.body;
oPopupBody.innerHTML = popCode;
oPopup.show(x, y, 140, 220, document.body);
}
function renderData(filterField){
alert("Joepie hij doet 't!");
alert(filterField);
}
The onclick in the first td alerts the value properly. The onclick in
the second td makes a call to the function renderData, but since this
function isn't defined within the variable 'popCode', it gives the
error 'Object expected'. I tried linking to the javascript file these
functions are in, in the <HEAD> section, but that's not working
either. Either the <HEAD> section is completely ignored or I'm making
some mistake.
1 Does anyone know how to do this properly, passing the variables to
the renderData function? or
2 Does anyone know how to explicitly state in the second onclick where
the renderData function is to be found?
Please help me, for I am truly really frustrated...Bye
Sharon
I'm trying to create a customized context menu using the DHTML Popup
object. The HTML that makes up the body of the popup is created in a
variable named 'popCode'. Works like a charm, except when I call a
function in an onclick it gives an 'object expected' error. Here's the
popup function (dopopup) and the function I'm calling (renderData):
function dopopup(Value,Field,x,y) {
popCode='';
popCode+='<html>\n<head>\n';
popCode+='<script type="text/javascript"
src="xTable.js"><\/script>\n';
popCode+='<\/head>\n<body>\n';
popCode+='<table style="border:1pt solid #808080" bgcolor="#CCCCCC"
width="140" height="220" cellpadding="0"
cellspacing="1" oncontextmenu=\"return false;\">\n';
popCode+='<STYLE TYPE="text/css">\n';
popCode+='td {font-family: Tahoma, Arial, Helvetica,
sans-serif;font-size: 8pt;font-style: normal;border:1pt solid
#CCCCCC; background:#CCCCCC;}\n';
popCode+='.over {background:#3366AF;color:#FFFFFF;border:1pt solid
#737B92}\n';
popCode+='<\/STYLE>\n';
popCode+='<script type="text/javascript"
src="xTable.js"><\/script>\n';
popCode+='<tr><td'
popCode+=' onMouseover="className=\'over\';"
onMouseout="className=\'\';" onClick="alert(\'' + Value +'\');">';
popCode+='Filter op: '+Field+' is '+Value+'</td></tr>\n';
popCode+='<tr><td';
popCode+=' onMouseover="className=\'over\';"
onMouseout="className=\'\';" onClick="renderData(\'' + Field
+'\');">';
popCode+='Filter op: '+Field+' is '+Value+'</td></tr>\n';
popCode+='</table>\n';
popCode+='<\/body>\n<\/html>\n';
var oPopupBody = oPopup.document.body;
oPopupBody.innerHTML = popCode;
oPopup.show(x, y, 140, 220, document.body);
}
function renderData(filterField){
alert("Joepie hij doet 't!");
alert(filterField);
}
The onclick in the first td alerts the value properly. The onclick in
the second td makes a call to the function renderData, but since this
function isn't defined within the variable 'popCode', it gives the
error 'Object expected'. I tried linking to the javascript file these
functions are in, in the <HEAD> section, but that's not working
either. Either the <HEAD> section is completely ignored or I'm making
some mistake.
1 Does anyone know how to do this properly, passing the variables to
the renderData function? or
2 Does anyone know how to explicitly state in the second onclick where
the renderData function is to be found?
Please help me, for I am truly really frustrated...Bye
Sharon