471,073 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Popup problems

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
Jul 23 '05 #1
2 1501
Sharon wrote:
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
Jul 23 '05 #2
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!
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Obantec Support | last post: by
38 posts views Thread by Shaun McKinnon | last post: by
8 posts views Thread by Bijoy Naick | last post: by
7 posts views Thread by E Michael Brandt | last post: by
2 posts views Thread by PC User | last post: by
reply views Thread by ALGARCIA | last post: by
7 posts views Thread by anthony.turcotte | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.