PDA

View Full Version : change the size and font color in document.write



meenakshi
05-23-2008, 01:50 PM
hi
i want to change the font size to 4 and color to red for the following
i tried using <font size=4></font> inside the document.write but did not got the result


<script type = "text/javascript">
var myDate = new Date();
var today = new Date();
var dd = today.getDate();
var dy = today.getDay();
var offset = Math.abs(2 - dy);
dd = dd - offset;
myDate.setDate(today.getDate() - offset)
var dateToDisplay = "";
if (myDate < today) {
dateToDisplay = myDate;
}
else {
dateToDisplay = today;
}
var a=dateToDisplay.getDate();
var b=dateToDisplay.getMonth();
document.write(a + "/" + b);

</script>

smile always
anand

Medyman
05-23-2008, 02:06 PM
Add CSS styling to the div that you're writing to instead of using deprecated tags within the javascript.

<div style="color:red;font-size:12px;">
<!-- SCRIPT OUTPUT -->
</div>