RetroZilla/layout/html/tests/attributes/div_p_heading.html
2015-10-20 23:03:22 -04:00

40 lines
1.1 KiB
HTML

<HTML>
<BODY>
<H1 ALIGN="center">This text is inside an H1 tag.</H1>
<DIV ALIGN="center" NOSHADE SIZE="5" WIDTH="50">This text is inside a DIV tag.</DIV>
<P ALIGN="center"> This text is inside a P tag.</P>
<P>
Use the buttons below to change the align attribute for the text showm
above.
</P>
<FORM>
<P>
Set <I>align</I> to
<SELECT SIZE="1" NAME="align">
<OPTION SELECTED VALUE="center">Center</OPTION>
<OPTION VALUE="left">Left</OPTION>
<OPTION VALUE="right">Right</OPTION>
</SELECT>
<INPUT TYPE="button" VALUE="Change Align" onClick="changeAlign(); return true;">
</P>
</FORM>
<SCRIPT>
var h1 = document.getElementsByTagName("h1")[0];
var div = document.getElementsByTagName("div")[0];
var para = document.getElementsByTagName("p")[0];
function changeAlign() {
if (document.forms[0].align.selectedIndex == 0) {
h1.align = div.align = para.align = "center";
}
else if (document.forms[0].align.selectedIndex == 1) {
h1.align = div.align = para.align = "left";
}
else {
h1.align = div.align = para.align = "right";
}
}
</SCRIPT>
</BODY>
</HTML>