tags:

views:

39

answers:

1

Does anyone know how can I replace onmousedown value with javascript?

for example:

<input style="display:inline" type="text" autocomplete="off" name="endDateAdd" id="endDate" onkeydown="return isNumberKey(event,this)" onmousedown="initCal(this, '{$minCal}', null)" value="{$endDate}">

For the code above, I want to replace onmousedown="initCal(this, '{$minCal}', null)" to onmousedown="initCal(this, '', null)". Does anyone know how to do it in javascript?

+2  A: 

Assuming you're talking about changing the event handler for the element when it's already on the page:

document.getElementById('endDate').onmousedown= function() {
    initCal(this, '', null);
};
bobince