new
git-svn-id: svn://10.0.0.236/trunk@22110 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
57
mozilla/layout/html/tests/TestFloaters.html
Normal file
57
mozilla/layout/html/tests/TestFloaters.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<BODY>
|
||||
<STYLE>
|
||||
DIV { border: 2px solid khaki; }
|
||||
DIV.left { border: 2px solid green; float: left; width: 100px; }
|
||||
DIV.left2 { border: 5px solid blue; float: left; width: 200px; }
|
||||
</STYLE>
|
||||
<SCRIPT>
|
||||
function getIndex()
|
||||
{
|
||||
var it = document.getElementById("getid");
|
||||
var index = it.value;
|
||||
if (index == "") index = 0;
|
||||
return index;
|
||||
}
|
||||
function makeFloater(clazz)
|
||||
{
|
||||
var div = document.createElement("DIV");
|
||||
var text = document.createTextNode("Block Text");
|
||||
div.appendChild(text);
|
||||
div.setAttribute("CLASS", clazz);
|
||||
return div;
|
||||
}
|
||||
function appendFloater()
|
||||
{
|
||||
var f = makeFloater("left");
|
||||
var it = document.getElementById("it");
|
||||
it.appendChild(f);
|
||||
}
|
||||
function insertFloater()
|
||||
{
|
||||
var f = makeFloater("left2");
|
||||
var it = document.getElementById("it");
|
||||
var kids = it.childNodes;
|
||||
var index = getIndex();
|
||||
if ((index < 0) || (index > kids.length)) index = 0;
|
||||
var before = kids[index];
|
||||
it.insertBefore(f, before);
|
||||
}
|
||||
function removeFloater()
|
||||
{
|
||||
var f = makeFloater("left2");
|
||||
var it = document.getElementById("it");
|
||||
var kids = it.childNodes;
|
||||
var index = getIndex();
|
||||
if ((index < 0) || (index > kids.length)) index = 0;
|
||||
it.removeChild(kids[index]);
|
||||
}
|
||||
</SCRIPT>
|
||||
<FORM>
|
||||
<INPUT TYPE=button ONCLICK="appendFloater();" value="Append Floater">
|
||||
<INPUT TYPE=button ONCLICK="insertFloater();" value="Insert Floater">
|
||||
<INPUT TYPE=button ONCLICK="removeFloater();" value="Remove Floater">
|
||||
<INPUT TYPE=text value="" ID="getid">
|
||||
</FORM>
|
||||
<HR>
|
||||
<DIV ID=it></DIV>
|
||||
</BODY>
|
||||
76
mozilla/layout/html/tests/TestInline2.html
Normal file
76
mozilla/layout/html/tests/TestInline2.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<BODY>
|
||||
<STYLE>
|
||||
DIV { border: 2px solid khaki; }
|
||||
</STYLE>
|
||||
<SCRIPT>
|
||||
var nextID = 1;
|
||||
function getIndex()
|
||||
{
|
||||
var it = document.getElementById("getid");
|
||||
var index = it.value;
|
||||
if (index == "") index = 0;
|
||||
return index;
|
||||
}
|
||||
function makeInline()
|
||||
{
|
||||
var image = document.createElement("IMG");
|
||||
image.setAttribute("SRC", "bluedot.gif");
|
||||
image.setAttribute("WIDTH", "100");
|
||||
image.setAttribute("HEIGHT", "40");
|
||||
image.setAttribute("BORDER", "2");
|
||||
image.setAttribute("ID", "obj" + nextID);
|
||||
nextID++;
|
||||
return image;
|
||||
}
|
||||
function makeBlock()
|
||||
{
|
||||
var block = document.createElement("DIV");
|
||||
var text = document.createTextNode("Block Text");
|
||||
block.appendChild(text);
|
||||
block.setAttribute("ID", "obj" + nextID);
|
||||
nextID++;
|
||||
return block;
|
||||
}
|
||||
function appendInline()
|
||||
{
|
||||
var i = makeInline();
|
||||
var it = document.getElementById("it");
|
||||
it.appendChild(i);
|
||||
}
|
||||
function insertInline()
|
||||
{
|
||||
var i = makeInline();
|
||||
var it = document.getElementById("it");
|
||||
var kids = it.childNodes;
|
||||
var index = getIndex();
|
||||
if ((index < 0) || (index > kids.length)) index = 0;
|
||||
var before = kids[index];
|
||||
it.insertBefore(i, before);
|
||||
}
|
||||
function appendBlock()
|
||||
{
|
||||
var b = makeBlock();
|
||||
var it = document.getElementById("it");
|
||||
it.appendChild(b);
|
||||
}
|
||||
function insertBlock()
|
||||
{
|
||||
var b = makeBlock();
|
||||
var it = document.getElementById("it");
|
||||
var kids = it.childNodes;
|
||||
var index = getIndex();
|
||||
if ((index < 0) || (index > kids.length)) index = 0;
|
||||
var before = kids[index];
|
||||
it.insertBefore(b, before);
|
||||
}
|
||||
</SCRIPT>
|
||||
<FORM>
|
||||
<INPUT TYPE=button ONCLICK="appendInline();" value="Append Inline">
|
||||
<INPUT TYPE=button ONCLICK="insertInline();" value="Insert Inline">
|
||||
<INPUT TYPE=button ONCLICK="appendBlock();" value="Append Block">
|
||||
<INPUT TYPE=button ONCLICK="insertBlock();" value="Insert Block"><BR>
|
||||
<INPUT TYPE=text value="" ID="getid">
|
||||
</FORM>
|
||||
<HR>
|
||||
<B ID=it></B>
|
||||
</BODY>
|
||||
Reference in New Issue
Block a user