Expand|Select|Wrap|Line Numbers
- <SCRIPT LANGUAGE=javascript>
- function tdclick (ObjTD) {
- ArrLinks = ObjTD.getElementsByTagName ("A");
- document.getElementById("link").onclick();
- }
- </SCRIPT>
- <table>
- <tr>
- <td id="Div_ID" onclick="javascript:tdclick(this);"> <a href="#" id="link" onclick="javascript:alert('It works');">test</a></td>
- </tr>
- </table>
Hi
My goal: I have a calendar in table-form. each TD element is a day.
Now they have to click on the hyperlink of the daynumber itself. for example: 3.
I want to change this:
If you click on the TD cell the onclick event of <a href should be executed.
Notice: the <a href is created in javascript as follow:
Expand|Select|Wrap|Line Numbers
- Date.toString().link("javascript:SelectDate(" + Date + ");");
So, I don't have the possibility to add an ID to the link.
Note: I don't want to add the onclick event directly in the TD tag. I prefer to make it seperate/dynamic.
If I use the ObjTD.ArrLinks[0].onclick(), it just don't work...
The only way is: document.getelementbyid...
is there a way around?
I would appreciate your help
thanks in advance