Click to See Complete Forum and Search --> : right-click javascript


Plisken
07-09-2003, 07:34 AM
Hi. I have 10-15 textboxes on my page. What I need is a javascript that puts todays date into whatever textbox the user right-clicks in. Is this possible?

Thanks,
Shawn

brendandonhue
07-09-2003, 08:27 AM
<script language="javascript">
function dateBox(obj)
{
var date = new Date();
obj.value = date;
}
</script>
<form name="form">
<input type="text" name="textbox" onclick="dateBox(this)">
</form>

Plisken
07-09-2003, 09:04 AM
Great, but can it be altered so that is only responds when a user clicks with right mouse button and not the left?

Shawn

brendandonhue
07-09-2003, 11:12 AM
Yes it can, but I don't know exactly how. Sorry. Someone here will :)