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)


 * Like I thought, by assigning a specific id only the first template on the page uses the Javascript... Probably because each id is unique. -- 09:22, January 8, 2012 (UTC)


 * Screw this, I can't find any solution. I'll just make 17 MediaWiki pages for this. -- 16:09, January 8, 2012 (UTC)