Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output queried data inside a JavaScript 1

Status
Not open for further replies.

JRAY

Technical User
Mar 28, 2001
13
0
0
US
I'm trying to output this queried data inside a JavaScript. I've tried several ways, but I just get errors. Here is what I currently have.

<cfoutput query=&quot;Menu&quot;>
dhtmlMenu = new NavBarMenu(110, 0);
dhtmlMenu.addItem(new NavBarMenuItem(&quot;#MenuItemText#&quot;, &quot;#MenuLinkPath#&quot;));
myNavBar1.addMenu(dhtmlMenu);
</cfoutput>

What am I doing wrong?
 
You getting JavaScript errors? I don't really know what your code does but try outputting it anyways and post the question in the JavaScript. They're pretty helpful there.

Klotzki
 
try this one


<cfoutput query=&quot;Menu&quot;>

<script language=&quot;javascript&quot;>

dhtmlMenu = new NavBarMenu(110, 0);
dhtmlMenu.addItem(new NavBarMenuItem(&quot;#MenuItemText#&quot;, &quot;#MenuLinkPath#&quot;));
myNavBar1.addMenu(dhtmlMenu);

</script>

</cfoutput>
 
JRAY are you getting CF error pages, or javascript errors ?

Test the javascript without the CF, make sure that works. Then, make sure you have <script language=&quot;javascript&quot;></script> surrounding your <CFOUTPUT query=&quot;&quot;></CFOUTPUT> . Im not sure what you're trying to do with javascript... but you just might be in the wrong forum.
 
I guess I wasn't clear...

The portion of code I displayed is within my script tags. The JavaScript works fine when I use static values. It's when I try to output the queried data that is the problem. IE just won't process it.
 
The Entire script tag should be embedded in the cfoutput tags. If it is not in cfoutput coldfusion simply skips that portion.

<cfoutput>

<script language=----------->
---------

--------

--------

-------
</script>

</cfoutput>
 
There's no need to put each iteration of the output in its own set of script tags ram123 .. is there? If he's just running commands why put a new set of <script> tags?

JRAY I understand, its javascript errors. So lets see dynamic javascript, past a little here, a few loops worth. If this is an IE issue, it may be that you have too many commands happenning at the same time, and that you need to use a timeout(2500,dhtmlMenu = new NavBarMenu(110, 0)) function, but you shouldn't need to seperate into different script tags.

If you can tell us what the javascript errors are exactly, and the line number its erroring on, and then paste the source of the page (not the CF code) and that line and the lines that surround it we might be able to help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top