PDA

View Full Version : Error in this trim code


wuffy77
12-09-2008, 08:01 AM
Ok, some stupid error somewhere, can anyone figure why this isn't displaying the date reformatted?



<html>
<head>
<script type="text/javascript">

function dateStyle(targetDate){
var inputDate = document.getElementById(targetDate).innerHTML;
var day = inputDate.slice(0,2);
var month = inputDate.slice(3,5);
document.getElementById(targetDate).innerHTML = "("+day + "/" + month +")";
}
</script>
</head>
<body>
<div id="dateInput">09/12/2008 10:37:12</div>
<script type="text/javascript">dateStyle(dateInput)</script>


</body>
</html>

coothead
12-09-2008, 08:50 AM
Hi there wuffy77,

pop some quotes in here....
<script type="text/javascript">dateStyle('dateInput')</script>

wuffy77
12-09-2008, 10:11 AM
doh!

<the rest of this text is simply to pad out this message as the preceding four characters summed up my response perfectly adequately, but the forum said my message was too short... ;) >

coothead
12-09-2008, 10:19 AM
doh!