[新着] Webテンプレートを仮オープンしました
<p><img src="" alt="" name="img1" id="img2"></p> <p><img src="" alt="" name="img2" id="img1"></p> <form name="form1" id="form2"></form> <form name="form2" id="form1"></form> <script type="text/javascript"> document.images['img1']; // ?? document.forms['form1']; // ?? </script>
<form action="">
<p>
<input name="input1" id="input2">
<input name="input2" id="input1">
</p>
</form>
<script type="text/javascript">
document.forms[0].elements['input1']; // ??
</script><script type="text/javascript">
window.onload = function()
{
var postForm = document.getElementById("postForm");
//ここでエラー
var textBoxs = postForm.getElementsByName("textBox");
textBoxs.item(0).value = "あいうえお";
}
</script>
<form action="aaa" method="post" id="postForm">
<div>
<input type="text" name="textBox" value="">
<input type="text" name="textBox" value="">
<input type="text" name="textBox" value="">
<input type="text" name="textBox" value="">
</div>
</form>// Node ////////////////////
function Node () {
this.nodeName = arguments[0]; /*String*/
this.nodeValue = arguments[1]; /*String*/
this.nodeType = arguments[2]; /*Number*/
}
Node.ELEMENT_NODE = 1;
Node.ATTRIBUTE_NODE = 2;
Node.TEXT_NODE = 3;
Node.prototype.insertBefore = function (newChild /*Node*/, refChild /*Node*/) {
return newChild;
};
Node.prototype.appendChild = function (newChild /*Node*/) {
return newChild;
};
// Document ////////////////////
function Document (nodeAttrs) {
Node.apply (this, nodeAttrs || [ ]);
this.doctype = arguments[1];
this.documentElement = arguments[2];
this.implementation = arguments[3];
}
Document.prototype = new Node;
Document.prototype.constructor = Document;
Document.prototype.getElementsByTagName = function (tagName /*String*/) {
return new NodeList;
};
Document.prototype.createElement = function (tagName /*String*/) {
return new Element (null, tagName);
};
Document.prototype.createTextNode = function (data /*String*/) {
return new Text (null, data);
};
// HTMLDocument ////////////////////
function HTMLDocument (documentAttrs) {
Document.apply (this, documentAttrs || [ ]);
this.title = arguments[1];
this.body = arguments[2];
this.forms = arguments[3];
this.images = arguments[4];
}
HTMLDocument.prototype = new Document;
HTMLDocument.prototype.constructor = HTMLDocument;
HTMLDocument.prototype.getElementsByName = function (elementName /*String*/) {
return new NodeList;
};
HTMLDocument.prototype.open = function () {
};
HTMLDocument.prototype.write = function (text) {
};
// ////////////////////
window.document = new HTMLDocument (...);