VchAlfredHall
New Member
I have a javascript function but if I use it, it doesn't work. If I use the same code without the function on my html it does work.\[code\]<script type="text/javascript">function jon(str) { id = 'j'+str; getElementById(id).setAttribute('class', '');}function jover(str) { id = 'j'+str; getElementById(id).setAttribute('class', 'hide');}</script><form id="lijst" action="" method="POST" onSubmit="return formOK();"> <table> <tr onMouseOver="getElementById('jtitle').setAttribute('class', '');" onMouseOut="getElementById('jtitle').setAttribute('class', 'hide');"> <th>* Title</th> <td><input type="text" name="title" /></td> <td id="jtitle" class="hide">Vul een film of serie titel in.</td> </tr> <tr onMouseOver="jon('type');" onMouseOut="jover('type');"> <th>* Type</th> <td><select name="type"><option value="http://stackoverflow.com/questions/13830754/film">Film</option><option value="http://stackoverflow.com/questions/13830754/serie">Serie</option></select></td> <td id="jtype" class="hide"></td> </tr>\[/code\]The title does work, but the type doesn't work.The console says the getElementById() isn't defined. I tried to put \[code\]var id = ''\[/code\] for the functions but that doesn't work.So how can I fix that?