Steve B
asked on
Centering Javascript Calendar within HTML Table tags.
Hi guys, I was hoping someone can give me a hand with this problem.
I am trying to get the whole calendar to be centered within the table.
I have written the entire code and I know I have left something out.
You can see what I mean by going to http://worldsplayground.com/TESTCALENDAR/Calendar.html
The javascript code can be found at = http://worldsplayground.com/TESTCALENDAR/layercalendar.js
I am trying to get the whole calendar to be centered within the table.
I have written the entire code and I know I have left something out.
You can see what I mean by going to http://worldsplayground.com/TESTCALENDAR/Calendar.html
The javascript code can be found at = http://worldsplayground.com/TESTCALENDAR/layercalendar.js
try,
<td width="715" height="225" align="center" valign="top" bgcolor="#FFF7DE"><table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="center">
<script language="JavaScript">
<!--
Calendar( );
// -->
</script>
</td>
</tr>
</table></td>
<td width="715" height="225" align="center" valign="top" bgcolor="#FFF7DE"><table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="center">
<script language="JavaScript">
<!--
Calendar( );
// -->
</script>
</td>
</tr>
</table></td>
ASKER
Hi guys,
What I am trying to do, is make the calendar fit the entire table, regardless of whether it has or doesn't have any events showing. At the moment, if there is an event or msgbox showing, the calendar fills in the entire table. If there is no event or msgbox, than only a small table is shown.
Cheers.
What I am trying to do, is make the calendar fit the entire table, regardless of whether it has or doesn't have any events showing. At the moment, if there is an event or msgbox showing, the calendar fills in the entire table. If there is no event or msgbox, than only a small table is shown.
Cheers.
ASKER
Hi Guys,
I have worked out my little problem, by ensuring that every month has a msgbox to show.
The problem I now am having is that some of the events are centered, others are aligned to the left.
When you get a chance can you have a look at it. Files are located at the same place.
I have worked out my little problem, by ensuring that every month has a msgbox to show.
The problem I now am having is that some of the events are centered, others are aligned to the left.
When you get a chance can you have a look at it. Files are located at the same place.
ASKER
Hi Guys,
I worked out the problem. I did not have an "align=left" command component where the event was being written.
document.write("<TD VALIGN=TOP align=left>"); <-- as shown
ShowDate(yr,mo,dy,i,curmo, curdy);
document.write("</TD>");
dy++;
}
}
What do I do now, that I have worked out the problem myself. Do I give you guys points for trying to help or do I just close the question. If I simply close the question - how do I do that too?
I worked out the problem. I did not have an "align=left" command component where the event was being written.
document.write("<TD VALIGN=TOP align=left>"); <-- as shown
ShowDate(yr,mo,dy,i,curmo,
document.write("</TD>");
dy++;
}
}
What do I do now, that I have worked out the problem myself. Do I give you guys points for trying to help or do I just close the question. If I simply close the question - how do I do that too?
I suppose it does depend what doctype you're using but I reccomend against using the align attribute, instead use CSS as is specified:
<td valign="top" style="text-align:center;" >
...sadly, this will only effect inline elements, so if you're trying to align a block element I'd suggest setting that in styles as well:
style="display:inline;"
...the inline suggestion applies to all children of the table cell you're centering.
Cheers,
Jesse
<td valign="top" style="text-align:center;"
...sadly, this will only effect inline elements, so if you're trying to align a block element I'd suggest setting that in styles as well:
style="display:inline;"
...the inline suggestion applies to all children of the table cell you're centering.
Cheers,
Jesse
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is this is your problem?
**************************
<td valign="top"><p> <------------ remove this <p>
<script language="JavaScript">
<!--
Calendar( );
// -->
</script>
</p></td> <------------ remove </p>
**************************
Or something else?