tags:

views:

221

answers:

1

i have a calendar formed table. and i was wondering how can i disable all the clicks under that cell. because my argument would be. anything less than the current date will be disable. meaning all click functions of all the child of the td on that dates will be disabled (add, edit, view list)

can you help me out. i cant give any code. coz is quite unorganized at this moment.

hope you can give me an idea.. Thanks

+1  A: 

On the event handler of your click event, you can prevent link following by returning false.

Super simplified:

function myClickHandler(e)
{
    var target = e.srcElement;
    if (!target)
        target = e.target;

    var sdate = new Date(target.parent.getAttribute("rel"));
    if (sdate < currentdate) // doesn't take into account time!!
        return false;
}

Given the following markup:

<table>
    <tbody>
        <tr>
            <td class="day" rel="1/1/2010">
                <a href="edit" onclick="return myClickHandler(e)">Edit this day</a>
            </td>
            ...
        </tr>
    </tbody>
</table>
Joel Potter
doesnt work for me. maybe this will disable the td's click.. but not the child of the td
Treby
Sorry, you have to return the value of the function. Edited to correct.
Joel Potter