PDA

View Full Version : Trying to center text


allyson
11-07-2002, 01:27 AM
Hi

Take a look at http://homepages.ihug.co.nz/~usateden . You will notice that as you roll the mouse over the palettes, the logo disappears and is replaced by a line of text, which is aligned left. I would like to change the alignment of the text to center. But as you can see in the code, I've tried changing the alignment to center, but it is not changing from it's original left alignment. Can anyone help with this please?

<script
language="javascript" type="text/javascript">
var MO_text = new Object();

MO_text['logo']='<p align="center"><img src="images/bigtitlelogo.GIF" name="slide" width="615" height="100">';
MO_text['artist_of_month'] = 'Find out who is the Panacea Artist of the Month';
MO_text['see_gallery'] ='Come in and see the Panacea Art Gallery';
MO_text['arts_trust'] = 'Find out about the Panacea Arts Trust';
MO_text['ebook'] = 'Use Microsoft Reader to read this website to you';







function getCell(id) {
return document.all ? document.all(id) :
document.getElementById ? document.getElementById(id) :
document.layers ? document['NS' + id].document.layers[0] : null;
}

function setCell(id, content, classname) {
var c = getCell(id);
if (!document.layers) {
c.innerHTML = content;
if (classname) c.className = classname;
} else {
var sSPAN = ((classname) ? '<span class="' + classname + '">' : '<span>');
c.document.write(sSPAN + content + '</span>');
c.document.close();
c.parentLayer.clip.width = c.clip.width;
c.parentLayer.clip.height = c.clip.height;
}
}
</script> <script language="javascript">
<!-- Preload logo
var image1=new Image()
image1.src="images/bigtitlelogo.gif"



function displaylogo() {
setCell('textcell',MO_text['logo']);


}

//-->
</script>
</p>

<table border="0" height="100">
<tr>
<td width="187" valign="top"><a href="#top"
onmouseover="setCell('textcell',MO_text['artist_of_month'],'mousetext')"
onmouseout="javascript:displaylogo()"><img src="palette/artmonth.gif" width="170"
height="122" border="0" alt="Panacea's Artist of the Month"></a></td>
<td width="187"></td>
<td width="187"></td>
<td width="187" valign="top"><a href="flashgallery/index.html"
onmouseover="setCell('textcell',MO_text['see_gallery'],'mousetext')"
onmouseout="javascript:displaylogo()"><img src="palette/gallery.gif" width="170"
height="122" border="0" alt="Panacea gallery"></a></td>
</tr>
</table>

<table border="0" height="110">
<tr>
<td width="101"></td>
<td width="615" valign="top" id="textcell" height="110"><p align="center"><ilayer id="NStextcell"><layer></p>
<p align="center"><span class="mousetext"></span> </layer></ilayer> <img src="images/bigtitlelogo.GIF"
width="615" height="100" border="0" name="slide"></td>
<td width="109"></td>
</tr>
</table>

<table border="0">
<tr>
<td width="187" valign="top"><a href="organisation/index.html"
onmouseover="setCell('textcell',MO_text['arts_trust'],'mousetext')"
onmouseout="javascript:displaylogo()"><img src="palette/organisation.GIF" width="170"
height="122" border="0" alt="Panacea Arts Trust"></a></td>
<td width="187" valign="top"></td>
<td width="187"></td>
<td width="187" valign="top"><a href="ebook/index.html"
onmouseover="setCell('textcell',MO_text['ebook'],'mousetext')"
onmouseout="javascript:displaylogo()"><img src="palette/ebook.GIF" width="170"
height="122" border="0" alt="Panacea Arts Trust Website Ebook"></a></td>
</tr>
</table>

<p align="center">&nbsp;</p>
</body>
</html>

====

bye
Allyson

victoria_1018
11-07-2002, 01:42 AM
Try using this method

MO_text['logo']='<p align="center"><img src="images/bigtitlelogo.GIF" name="slide" width="615" height="100">';
MO_text['artist_of_month'] = ' <p align="center"> Find out who is the Panacea Artist of the Month';
MO_text['see_gallery'] ='<p align="center"> Come in and see the Panacea Art Gallery';
MO_text['arts_trust'] = '<p align="center"> Find out about the Panacea Arts Trust';
MO_text['ebook'] = '<p align="center"> Use Microsoft Reader to read this website to you'

Another method is:

I used to use web designing software to do all these design and attached the onto my website. One of the software which is very easy to use and handle is Dreamweaver to support mouse over image and Microsoft Image Composer for image designing.

Regards

whammy
11-07-2002, 01:56 AM
Wow, that is very incorrect HTML... no offense intended. But it should work for now... in the meantime if I were you, I'd check out:

http://www.w3schools.com/css

and

http://www.w3schools.com/xhtml

Since stylesheets and XHTML will make your life a lot easier (and it will be a lot easier on the modern and future browsers when rendering your code!).

:D