JavaScript in Velocity

They have: 3 posts

Joined: Apr 2004

Hi,

Dose anyone know how to put a JavaScript in Velocity Scripts. I have a Javascript drop down menu which i want to include in .vm file using .js but it doesnt work.

Anyone know how to make this work.

Please help

Thanks

Ptaz.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

I've never heard of Velocity, I'm afraid. Is it a server-side language?

They have: 3 posts

Joined: Apr 2004

Velocity is like ASP but used on a Linux Server. Basically, Velocity integrates with the Jakarta Struts Web application framework and enables the use of velocity templates interchangeably with JSP pages for the view layer.

They have: 5,633 posts

Joined: Jan 1970

I have no clue! and I use JScript

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Right. In that case, you should be able to output Javascript inline with your other output, whether you use templates or generate it otherwise.

What are you having trouble with exactly? Inserting the Javascript code, or creating a dropdown, or something to do with Velocity, or what? Smiling

They have: 3 posts

Joined: Apr 2004

i have done the dropdown javascript. Problem is when i put the script in, the dropdown dose not work. I put the script in the header.vm file, this header then is parsed through all the .vm pages. But when the page is loaded the dropdown dose not work.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Examples are required, please.

druagord's picture

He has: 335 posts

Joined: May 2003

Probably youre probleme comes from a misplace include of the js file

Server-side language like JSP or ASP are processed by the server before the page is sent to the browser and only the html result are sent. javascript on the other hand are processed in the browser so you have to make sure your script tag get there.

Like Suzanne said it would be easier to understand for every body if you did include a link or some code

IF , ELSE , WHILE isn't that what life is all about

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.