Forum:Javascript in templates

Is it possible to combine Javascript with template usage?

I'm not sure if there's a way to have variable parameters as ids or classes that can be used by Javascript. Say you make a template that sets an "id=name1" to a div box. Then you use the same template on the same page for another item, which sets "id=name2".

How would these ids be recognized by the Javascript, if you use document.getElementById and stuff like that? -- 12:21, January 7, 2012 (UTC)