cfoutput inside javascript

  • 18 years ago

    I'm Trying to Output data inside a script page for a menu. Is there any way this would work? Does anyone know how to Query DBases using Plain Script?


    My Code Is Below:





    var currentPopOut = "none";
    var currentMenu = "none";
    var HTMLStr


    function mOver(sender)
    {
    var poperid = sender.id;
    document.all(poperid).className="eOff";


    if (currentPopOut != "none")
    {
    document.all(currentPopOut).style.display = "none";
    currentPopOut = "none";
    }
    if (currentMenu != "none" && currentMenu != poperid)
    {
    document.all(currentMenu).className="e";
    currentMenu = "none";
    }


    currentMenu = poperid
    poperid = poperid.replace(/poper/, "popup")
    currentPopOut = poperid;
    document.all(poperid).style.display = "";
    window.event.cancelBubble = true;
    }


    function mPopupOver(sender)
    {
    window.event.cancelBubble = true;
    }


    HTMLStr =
    "<script language=javascript for=document event=onmouseover>" +
    "if (currentPopOut != 'none')" +
    "{" +
    " document.all(currentPopOut).style.display = 'none';" +
    " currentPopOut = 'none';" +
    "}" +
    "if (currentMenu != 'none')" +
    "{" +
    " document.all(currentMenu).className='e';" +
    " currentMenu = 'none';" +
    "}" +
    "</script>" +


    " <div id=poper1 class=e onmouseover='mOver(this)'>Dessert Products</div>" +
    " <div onmouseover='mPopupOver(this)' id=popup1 class=ePopup style='display:none;'>" +
    " <table width=300 class=eSub cellpadding=2>" +
    " <tr>" +
    " <td width=5 rowspan=9></td>" +
    " <td colspan=2>Select a category:</td>" +
    <CFSET Counter = 1><cfoutput query="getemp"><CFIF Counter eq 1>
    " </tr>" +
    " <tr>" +
    </CFIF>
    " <td width=148>• <Span class=ea><a href=?keyword=showprod&stable=0&str=0&std=0&Type=#idnm#&Tid=#session.Vitals[2]#>#Name#</a></Span></td>" +
    <CFIF Counter eq 2>
    " </tr>" +
    <CFSET Counter = 1><CFELSE><CFSET Counter = Counter + 1></CFIF></cfoutput>
    " </table>" +
    " </div>";


    document.write (HTMLStr)

  • 18 years ago


    After a quick look, (and i know it's been a long time since the post)


    It seems you are trying to Javascript to output a Coldfusion page.
    This will not work  because the Javascript is executed on the browser,
    the Cold fusion needs to executed on the server...before arriving at the browser...



    Hope it Helps

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks