Made style reresolution propogate down to the bullet frames for list items. Added list related attribute tests.
This commit is contained in:
Родитель
d4f1fb81f1
Коммит
7d78aa4ffc
|
@ -219,7 +219,7 @@ nsHTMLLIElement::GetStyleHintForAttributeChange(
|
|||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint);
|
||||
|
|
|
@ -240,16 +240,11 @@ nsHTMLOListElement::GetStyleHintForAttributeChange(
|
|||
const nsIAtom* aAttribute,
|
||||
PRInt32 *aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::start) {
|
||||
if (aAttribute == nsHTMLAtoms::start) {
|
||||
*aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::compact) {
|
||||
else if ((aAttribute == nsHTMLAtoms::type) ||
|
||||
(aAttribute == nsHTMLAtoms::compact)) {
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -218,13 +218,8 @@ nsHTMLUListElement::GetStyleHintForAttributeChange(
|
|||
const nsIAtom* aAttribute,
|
||||
PRInt32 *aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::compact) {
|
||||
if ((aAttribute == nsHTMLAtoms::type) ||
|
||||
(aAttribute == nsHTMLAtoms::compact)) {
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -543,6 +543,18 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
rv = ReResolveLineList(aPresContext, lines, mStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Need to check if the bullet is inside and hence
|
||||
// in the line list. If so, we don't need to do this.
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mBullet)) {
|
||||
nsIStyleContext* bulletSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsHTMLAtoms::mozListBulletPseudo,
|
||||
mStyleContext,
|
||||
PR_FALSE, &bulletSC);
|
||||
rv = mBullet->SetStyleContext(aPresContext, bulletSC);
|
||||
NS_RELEASE(bulletSC);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ nsHTMLLIElement::GetStyleHintForAttributeChange(
|
|||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint);
|
||||
|
|
|
@ -240,16 +240,11 @@ nsHTMLOListElement::GetStyleHintForAttributeChange(
|
|||
const nsIAtom* aAttribute,
|
||||
PRInt32 *aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::start) {
|
||||
if (aAttribute == nsHTMLAtoms::start) {
|
||||
*aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::compact) {
|
||||
else if ((aAttribute == nsHTMLAtoms::type) ||
|
||||
(aAttribute == nsHTMLAtoms::compact)) {
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -218,13 +218,8 @@ nsHTMLUListElement::GetStyleHintForAttributeChange(
|
|||
const nsIAtom* aAttribute,
|
||||
PRInt32 *aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
// XXX This shouldn't require a frame change, just a reapplication
|
||||
// of style down the tree (and a reflow). The style changes aren't
|
||||
// percolating down far enough.
|
||||
*aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::compact) {
|
||||
if ((aAttribute == nsHTMLAtoms::type) ||
|
||||
(aAttribute == nsHTMLAtoms::compact)) {
|
||||
*aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
<IMG src="resource:/res/samples/raptor.jpg" STYLE="float: left;">
|
||||
<IMG src="mynet.gif" STYLE="float: right;">
|
||||
This text should appear between a left justified and right justified image of a raptor.<BR>
|
||||
Resize the window such that this paragraph is located between the two images. Then
|
||||
use the form below to change the "clear" attribute of the BR tag that adds a linebreak
|
||||
between this para and the previous one. Clearing to left should position this para below
|
||||
the raptor. Clearing to the right or clearing all should position this para below the My
|
||||
Netscape ad.
|
||||
<FORM>
|
||||
<P>
|
||||
Set <I>clear</I> to
|
||||
<SELECT SIZE="1" NAME="clear">
|
||||
<OPTION SELECTED VALUE="none">None</OPTION>
|
||||
<OPTION VALUE="left">Left</OPTION>
|
||||
<OPTION VALUE="right">Right</OPTION>
|
||||
<OPTION VALUE="all">All</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Clear" onClick="changeClear(); return true;">
|
||||
</P>
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var br = document.getElementsByTagName("br")[0];
|
||||
function changeClear() {
|
||||
if (document.forms[0].clear.selectedIndex == 0)
|
||||
br.clear = "none";
|
||||
else if (document.forms[0].clear.selectedIndex == 1)
|
||||
br.clear = "left";
|
||||
else if (document.forms[0].clear.selectedIndex == 1)
|
||||
br.clear = "right";
|
||||
else
|
||||
br.clear = "all";
|
||||
}
|
||||
</SCRIPT>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -0,0 +1,40 @@
|
|||
<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>
|
|
@ -0,0 +1,76 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<BASEFONT COLOR="green" FACE="Times New Roman" SIZE="3">
|
||||
<P>
|
||||
This text's style is affected by applying style changes to the BASEFONT tag.
|
||||
</P>
|
||||
<P>
|
||||
<FONT COLOR="red" FACE="Arial" SIZE="5">This text is contained in
|
||||
a FONT tag. So, style changes to the BASEFONT and the FONT tag affect it.</FONT>
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Use the form below to apply style changes to the text above.
|
||||
</P>
|
||||
|
||||
<FORM>
|
||||
<P>
|
||||
<INPUT TYPE="radio" NAME="applyTo" VALUE="font" CHECKED>Apply style change to FONT tag <BR>
|
||||
<INPUT TYPE="radio" NAME="applyTo" VALUE="basefont">Apply style change to BASEFONT tag <BR>
|
||||
</P>
|
||||
<P>
|
||||
Set <I>size</I> to
|
||||
<INPUT TYPE="text" NAME="size" VALUE="5">
|
||||
<INPUT TYPE="button" VALUE="Change Size" onClick="changeSize(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set <I>face</I> to
|
||||
<SELECT SIZE="1" NAME="face">
|
||||
<OPTION SELECTED VALUE="times">Times New Roman</OPTION>
|
||||
<OPTION VALUE="arial">Arial</OPTION>
|
||||
<OPTION VALUE="courier">Courier</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Face" onClick="changeFace(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set <I>color</I> to
|
||||
<INPUT TYPE="text" NAME="color" VALUE="red">
|
||||
<INPUT TYPE="button" VALUE="Change Color" onClick="changeColor(); return true;">
|
||||
</P>
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var fnt = document.getElementsByTagName("font")[0];
|
||||
var basefnt = document.getElementsByTagName("basefont")[0];
|
||||
var obj = null;
|
||||
|
||||
function determineTarget() {
|
||||
if (document.forms[0].applyTo.checked)
|
||||
obj = fnt;
|
||||
else
|
||||
obj = basefnt;
|
||||
}
|
||||
|
||||
function changeSize() {
|
||||
determineTarget();
|
||||
obj.size = document.forms[0].size.value;
|
||||
}
|
||||
|
||||
function changeFace() {
|
||||
determineTarget();
|
||||
if (document.forms[0].face.selectedIndex == 0)
|
||||
obj.face = "Times New Roman";
|
||||
else if (document.forms[0].face.selectedIndex == 1)
|
||||
obj.face = "Arial";
|
||||
else
|
||||
obj.face = "Courier New";
|
||||
}
|
||||
|
||||
function changeColor() {
|
||||
determineTarget();
|
||||
obj.color = document.forms[0].color.value;
|
||||
}
|
||||
|
||||
</SCRIPT>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -0,0 +1,64 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
<HR ALIGN="center" NOSHADE SIZE="5" WIDTH="50">
|
||||
|
||||
<P>
|
||||
Use the buttons below to set values for the different attributes for the HR shown
|
||||
above.
|
||||
</P>
|
||||
|
||||
<FORM>
|
||||
<P>
|
||||
Set <I>size</I> to
|
||||
<INPUT TYPE="text" NAME="size" VALUE="5">
|
||||
<INPUT TYPE="button" VALUE="Change Size" onClick="changeSize(); return true;">
|
||||
</P>
|
||||
<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>
|
||||
<P>
|
||||
Set <I>noshade</I> to
|
||||
<SELECT SIZE="1" NAME="noshade">
|
||||
<OPTION SELECTED VALUE="true" >True</OPTION>
|
||||
<OPTION VALUE="false">False</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change NoShade" onClick="changeNoShade(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set <I>width</I> to
|
||||
<INPUT TYPE="text" NAME="width" VALUE="50">
|
||||
<INPUT TYPE="button" VALUE="Change Width" onClick="changeWidth(); return true;">
|
||||
</P>
|
||||
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var hr = document.getElementsByTagName("hr")[0];
|
||||
function changeSize() {
|
||||
hr.size = document.forms[0].size.value;
|
||||
}
|
||||
function changeAlign() {
|
||||
if (document.forms[0].align.selectedIndex == 0)
|
||||
hr.align = "center";
|
||||
else if (document.forms[0].align.selectedIndex == 1)
|
||||
hr.align = "left";
|
||||
else
|
||||
hr.align = "right";
|
||||
}
|
||||
function changeNoShade(value) {
|
||||
if (document.forms[0].noshade.selectedIndex == 0)
|
||||
hr.noShade = true;
|
||||
else
|
||||
hr.noShade = false;
|
||||
}
|
||||
function changeWidth(width) {
|
||||
hr.width = document.forms[0].width.value;
|
||||
}
|
||||
</SCRIPT>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -0,0 +1,92 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
<h1>Attribute tests for OL and LI elements</h1>
|
||||
<ol ID="myol">
|
||||
<li id="1st">One</li>
|
||||
<li id="2nd">Two
|
||||
<ol>
|
||||
<li>Apples</li>
|
||||
<li>Oranges</li>
|
||||
<li>Bananas</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li id="3rd">Three</li>
|
||||
</ol>
|
||||
<P>
|
||||
Use the buttons below to change the attributes of the OL and LI elements.
|
||||
</P>
|
||||
|
||||
<FORM>
|
||||
<P>
|
||||
Set OL element's <I>type</I> to
|
||||
<SELECT SIZE="1" NAME="type">
|
||||
<OPTION SELECTED VALUE="1">numerical</OPTION>
|
||||
<OPTION VALUE="a">lower arabic</OPTION>
|
||||
<OPTION VALUE="A">upper ararbic</OPTION>
|
||||
<OPTION VALUE="i">lower roman</OPTION>
|
||||
<OPTION VALUE="I">upper roman</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeType(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set OL element's <I>start</I> to
|
||||
<INPUT TYPE="text" MAXLENGTH="2" SIZE="2" NAME="start">
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeStart(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set the
|
||||
<SELECT SIZE="1" NAME="nth">
|
||||
<OPTION SELECTED VALUE="1st">1st</OPTION>
|
||||
<OPTION VALUE="2nd">2nd</OPTION>
|
||||
<OPTION VALUE="3rd">3rd</OPTION>
|
||||
</SELECT>
|
||||
LI element's <I>type</I> attribute to
|
||||
<SELECT SIZE="1" NAME="type2">
|
||||
<OPTION SELECTED VALUE="1">numerical</OPTION>
|
||||
<OPTION VALUE="a">lower arabic</OPTION>
|
||||
<OPTION VALUE="A">upper ararbic</OPTION>
|
||||
<OPTION VALUE="i">lower roman</OPTION>
|
||||
<OPTION VALUE="I">upper roman</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeElementType(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set the
|
||||
<SELECT SIZE="1" NAME="nth2">
|
||||
<OPTION SELECTED VALUE="1st">1st</OPTION>
|
||||
<OPTION VALUE="2nd">2nd</OPTION>
|
||||
<OPTION VALUE="3rd">3rd</OPTION>
|
||||
</SELECT>
|
||||
LI element's <I>value</I> attribute to
|
||||
<INPUT TYPE="text" MAXLENGTH="2" SIZE="2" NAME="start2">
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeElementStart(); return true;">
|
||||
</P>
|
||||
</P>
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var ol = document.getElementById("myol");
|
||||
var types = new Array("1", "a", "A", "i", "I");
|
||||
function changeType() {
|
||||
ol.type = types[document.forms[0].type.selectedIndex];
|
||||
}
|
||||
|
||||
function changeStart() {
|
||||
ol.start = Number(document.forms[0].start.value);
|
||||
}
|
||||
|
||||
// We should be able to do this with the select elements value, but
|
||||
// since that doesn't work we need to maintain this array.
|
||||
var nth = new Array("1st", "2nd", "3rd");
|
||||
function changeElementType() {
|
||||
var li = document.getElementById(nth[document.forms[0].nth.selectedIndex]);
|
||||
li.type = types[document.forms[0].type2.selectedIndex];
|
||||
}
|
||||
|
||||
function changeElementStart() {
|
||||
var li = document.getElementById(nth[document.forms[0].nth2.selectedIndex]);
|
||||
li.value = Number(document.forms[0].start2.value);
|
||||
}
|
||||
</SCRIPT>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -0,0 +1,29 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
<PRE WIDTH="50">
|
||||
This text is within a PRE tag. This text is within a PRE tag.
|
||||
This text is within a PRE tag. This text is within a PRE tag.
|
||||
This text is within a PRE tag. This text is within a PRE tag.
|
||||
This text is within a PRE tag. This text is within a PRE tag.
|
||||
This text is within a PRE tag. This text is within a PRE tag.
|
||||
</PRE>
|
||||
<P>
|
||||
Use the buttons below to change the width attributes for the preformatted text above.
|
||||
</P>
|
||||
|
||||
<FORM>
|
||||
<P>
|
||||
Set <I>width</I> to
|
||||
<INPUT TYPE="text" NAME="width" VALUE="50">
|
||||
<INPUT TYPE="button" VALUE="Change Width" onClick="changeWidth(); return true;">
|
||||
</P>
|
||||
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var pre = document.getElementsByTagName("pre")[0];
|
||||
function changeWidth() {
|
||||
pre.width = Math.abs(document.forms[0].width.value);
|
||||
}
|
||||
</SCRIPT>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -0,0 +1,78 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
<h1>Attribute tests for UL and LI elements</h1>
|
||||
<ul ID="myul">
|
||||
<li id="1st">One</li>
|
||||
<li id="2nd">Two
|
||||
<ul>
|
||||
<li>Apples</li>
|
||||
<li>Oranges</li>
|
||||
<li>Bananas</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="3rd">Three</li>
|
||||
</ul>
|
||||
|
||||
<P>
|
||||
Use the buttons below to change the attributes of the UL and LI elements.
|
||||
</P>
|
||||
|
||||
<FORM>
|
||||
<P>
|
||||
Set UL element's <I>type</I> to
|
||||
<SELECT SIZE="1" NAME="type">
|
||||
<OPTION SELECTED VALUE="disc">disc</OPTION>
|
||||
<OPTION VALUE="circle">circle</OPTION>
|
||||
<OPTION VALUE="square">square</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeType(); return true;">
|
||||
</P>
|
||||
<P>
|
||||
Set the
|
||||
<SELECT SIZE="1" NAME="nth">
|
||||
<OPTION SELECTED VALUE="1st">1st</OPTION>
|
||||
<OPTION VALUE="2nd">2nd</OPTION>
|
||||
<OPTION VALUE="3rd">3rd</OPTION>
|
||||
</SELECT>
|
||||
LI element's <I>type</I> attribute to
|
||||
<SELECT SIZE="1" NAME="type2">
|
||||
<OPTION SELECTED VALUE="disc">disc</OPTION>
|
||||
<OPTION VALUE="circle">circle</OPTION>
|
||||
<OPTION VALUE="square">square</OPTION>
|
||||
</SELECT>
|
||||
<INPUT TYPE="button" VALUE="Change Type" onClick="changeElementType(); return true;">
|
||||
</P>
|
||||
</FORM>
|
||||
<SCRIPT>
|
||||
var ul = document.getElementById("myul");
|
||||
function changeType() {
|
||||
if (document.forms[0].type.selectedIndex == 0) {
|
||||
ul.type = "disc";
|
||||
}
|
||||
else if (document.forms[0].type.selectedIndex == 1) {
|
||||
ul.type = "circle";
|
||||
}
|
||||
else {
|
||||
ul.type = "square";
|
||||
}
|
||||
}
|
||||
|
||||
// We should be able to do this with the select elements value, but
|
||||
// since that doesn't work we need to maintain this array.
|
||||
var nth = new Array("1st", "2nd", "3rd");
|
||||
function changeElementType() {
|
||||
var li = document.getElementById(nth[document.forms[0].nth.selectedIndex]);
|
||||
if (document.forms[0].type2.selectedIndex == 0) {
|
||||
li.type = "disc";
|
||||
}
|
||||
else if (document.forms[0].type2.selectedIndex == 1) {
|
||||
li.type = "circle";
|
||||
}
|
||||
else {
|
||||
li.type = "square";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
Загрузка…
Ссылка в новой задаче