Hello,
I am hoping one of you guru's can help me out. I am new to Javascript and a bit of a hack at HTML. The following works correctly in IE7 but doesn't work in Firefox. Any idea?
Also, is there any way to get IE to quit waring people of active content when they open this page with the annoying menubar thing?
An lastly is there a way to get the field to autopopulate when someone loads the page instead of the user having to click the button?
Thanks for any help you can give!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Click here</title>
<script type="text/javascript">
function setTodayDate(id, offset) {
// dd/mm/yyyy
var date = new Date();
if(offset!==undefined)
date.setSeconds(date.getSeconds()+offset);
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
var obj = document.getElementById(id);
if(obj)
obj.value = month+'/'+day+'/'+year;
}
</script>
</head>
<body>
<a href="#" onclick="setTodayDate('testfield', 2*24*60*60 );">Click here</a><br>
<input name="testfield" type="text" value size="12">
</body>
</html>