Popup problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sharon

    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,F ield,x,y) {
    popCode='';
    popCode+='<html >\n<head>\n';
    popCode+='<scri pt type="text/javascript"
    src="xTable.js" ><\/script>\n';
    popCode+='<\/head>\n<body>\n ';
    popCode+='<tabl e style="border:1 pt solid #808080" bgcolor="#CCCCC C"
    width="140" height="220" cellpadding="0"
    cellspacing="1" oncontextmenu=\ "return false;\">\n';
    popCode+='<STYL E TYPE="text/css">\n';
    popCode+='td {font-family: Tahoma, Arial, Helvetica,
    sans-serif;font-size: 8pt;font-style: normal;border:1 pt solid
    #CCCCCC; background:#CCC CCC;}\n';
    popCode+='.over {background:#33 66AF;color:#FFF FFF;border:1pt solid
    #737B92}\n';
    popCode+='<\/STYLE>\n';
    popCode+='<scri pt type="text/javascript"
    src="xTable.js" ><\/script>\n';
    popCode+='<tr>< td'
    popCode+=' onMouseover="cl assName=\'over\ ';"
    onMouseout="cla ssName=\'\';" onClick="alert( \'' + Value +'\');">';
    popCode+='Filte r op: '+Field+' is '+Value+'</td></tr>\n';
    popCode+='<tr>< td';
    popCode+=' onMouseover="cl assName=\'over\ ';"
    onMouseout="cla ssName=\'\';" onClick="render Data(\'' + Field
    +'\');">';
    popCode+='Filte r op: '+Field+' is '+Value+'</td></tr>\n';
    popCode+='</table>\n';
    popCode+='<\/body>\n<\/html>\n';
    var oPopupBody = oPopup.document .body;
    oPopupBody.inne rHTML = popCode;
    oPopup.show(x, y, 140, 220, document.body);
    }

    function renderData(filt erField){
    alert("Joepie hij doet 't!");
    alert(filterFie ld);
    }

    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...By e
    Sharon
  • Mick White

    #2
    Re: Popup problems

    Sharon wrote:
    [color=blue]
    > 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):[/color]

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

    [color=blue]
    >
    > function dopopup(Value,F ield,x,y) {
    > popCode='';
    > popCode+='<html >\n<head>\n';
    > popCode+='<scri pt type="text/javascript"
    > src="xTable.js" ><\/script>\n';
    > popCode+='<\/head>\n<body>\n ';
    > popCode+='<tabl e style="border:1 pt solid #808080" bgcolor="#CCCCC C"
    > width="140" height="220" cellpadding="0"[/color]

    height="220" , invalid
    [color=blue]
    > cellspacing="1" oncontextmenu=\ "return false;\">\n';[/color]

    "oncontextm enu" IE Win only, I believe, and a bad idea.
    [color=blue]
    > popCode+='<STYL E TYPE="text/css">\n';
    > popCode+='td {font-family: Tahoma, Arial, Helvetica,
    > sans-serif;font-size: 8pt;font-style: normal;border:1 pt solid
    > #CCCCCC; background:#CCC CCC;}\n';[/color]

    8 pt??????[color=blue]
    > popCode+='.over {background:#33 66AF;color:#FFF FFF;border:1pt solid
    > #737B92}\n';
    > popCode+='<\/STYLE>\n';
    > popCode+='<scri pt type="text/javascript"
    > src="xTable.js" ><\/script>\n';
    > popCode+='<tr>< td'
    > popCode+=' onMouseover="cl assName=\'over\ ';"[/color]

    this.className, surely?
    [color=blue]
    > onMouseout="cla ssName=\'\';" onClick="alert( \'' + Value +'\');">';
    > popCode+='Filte r op: '+Field+' is '+Value+'</td></tr>\n';
    > popCode+='<tr>< td';
    > popCode+=' onMouseover="cl assName=\'over\ ';"
    > onMouseout="cla ssName=\'\';" onClick="render Data(\'' + Field
    > +'\');">';
    > popCode+='Filte r op: '+Field+' is '+Value+'</td></tr>\n';
    > popCode+='</table>\n';
    > popCode+='<\/body>\n<\/html>\n';
    > var oPopupBody = oPopup.document .body;
    > oPopupBody.inne rHTML = popCode;[/color]

    Looks like you're trying to to place head content into the document body..[color=blue]
    > oPopup.show(x, y, 140, 220, document.body);
    > }
    >
    > function renderData(filt erField){
    > alert("Joepie hij doet 't!");
    > alert(filterFie ld);
    > }[/color]

    Do you have a URL?
    Mick

    Comment

    • Sharon Steringa

      #3
      Re: Popup problems

      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!

      Comment

      Working...