Popup problems

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
 
M

Mick White

Sharon said:
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):

It looks as if your code is designed for IE windows exclusively:

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"

height="220" , invalid
cellspacing="1" oncontextmenu=\"return false;\">\n';

"oncontextmenu" IE Win only, I believe, and a bad idea.
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';

8 pt??????
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\';"

this.className, surely?
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;

Looks like you're trying to to place head content into the document body..
oPopup.show(x, y, 140, 220, document.body);
}

function renderData(filterField){
alert("Joepie hij doet 't!");
alert(filterField);
}

Do you have a URL?
Mick
 
S

Sharon Steringa

Yes, you're right, it ís designed for IE6 exclusively, that's because
it's part of a software package. Clients who use that package also use
IE6 only. I don't have an URL, the only head content I'm placing in the
body is the <script>-part. I placed that first in the head, and later
also in the body to see if it would work. But it didn't. Can you help me
call the function renderData() in the onclick of dopopup?


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top