#!/bin/sh
echo \"Content-type: text/html\"
echo \"\"
echo \'\'
echo \'\'
echo \'
The reason for that is because document.getElementById returns first element matching that id.
Try changing your code like this:
onclick=myFunction(this) - you can use this here, it will reference the <a/> element being clicked
function myFunction(movieElement) {
var mtype = movieElement.text;
alert(mtype);
}
Please also note, that it's considered to be bad practice, if you use non-unique values for id attribute. As the name indicates it should be the identifying attribute and unique for the whole document.