Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
527 02.12.2003 16:40
Действительно надо боротся с тем что стандартной формой закачать можно только один файл за раз.<HTML> <HEAD> <TITLE>Wrox Press book data entry page</TITLE> </HEAD> <BODY onload="initializeBook()"> <H1>Wrox Press book data entry page</H1> <H3>Book information:</H3> <TABLE> <TR> <TD>Title:</TD><TD><INPUT id=txtTitle></TD> </TR> <TR> <TD>Publisher:</TD><TD><INPUT id=txtPublisher></TD> </TR> <TR> <TD>Published Date:</TD><TD><INPUT id=txtPubDate></TD> </TR> <TR> <TD>Abstract:</TD><TD><INPUT id=txtAbstract></TD> </TR> <TR> <TD>Pages:</TD><TD><INPUT id=txtPages></TD> </TR> <TR> <TD>ISBN:</TD><TD><INPUT id=txtISBN></TD> </TR> <TR> <TD>Price:</TD><TD><INPUT id=txtPrice></TD> </TR> </TABLE> <INPUT id=btnUpdate type=button value="Update book info" onclick="updateBookInfo()"> <H3>Authors:</H3> <TABLE> <TR> <TD>Author:</TD><TD><INPUT id=txtAuthor></TD> </TR> </TABLE> <INPUT id=btnAddAuthor type=button value="Add author" onclick="addAuthor()"> <H3>Categories:</H3> <TABLE> <TR> <TD>Category:</TD><TD><INPUT id=txtCategory></TD> </TR> </TABLE> <INPUT id=btnAddCategory type=button value="Add category" onclick="addCategory()"> <XML id=docBook> <Book> </Book> </XML> <SCRIPT> var docBook; function initializeBook() { docBook = document.all("docBook").XMLDocument; docBook.async = false; renderElements(); } function createOrReplaceElement(sElementName, sElementValue, elementParent) { var elementItem; var textValue; var nodelistOldItem; elementItem = docBook.createElement(sElementName); textValue = docBook.createTextNode(sElementValue); elementItem.appendChild(textValue); nodelistOldItem = elementParent.getElementsByTagName(sElementName); if (nodelistOldItem.length > 0) { elementParent.replaceChild(elementItem, nodelistOldItem.item(0)); } else { elementParent.appendChild(elementItem); } } function updateBookInfo() { createOrReplaceElement("Title", txtTitle.value, docBook.documentElement); createOrReplaceElement("Publisher", txtPublisher.value, docBook.documentElement); createOrReplaceElement("PubDate", txtPubDate.value, docBook.documentElement); createOrReplaceElement("Abstract", txtAbstract.value, docBook.documentElement); createOrReplaceElement("Pages", txtPages.value, docBook.documentElement); createOrReplaceElement("ISBN", txtISBN.value, docBook.documentElement); createOrReplaceElement("Price", txtPrice.value, docBook.documentElement); renderElements(); } function addAuthor() { var elementAuthor; var textAuthor; var nodelistAuthors; var elementAuthors; elementAuthor = docBook.createElement("Author"); textAuthor = docBook.createTextNode(txtAuthor.value); elementAuthor.appendChild(textAuthor); nodelistAuthors = docBook.getElementsByTagName("Authors"); if (nodelistAuthors.length == 0) { elementAuthors = docBook.createElement("Authors"); docBook.documentElement.appendChild(elementAuthors); } else { elementAuthors = nodelistAuthors.item(0); } elementAuthors.appendChild(elementAuthor); renderElements(); } function addCategory() { var elementCategory; var textCategory; var nodelistRecSubjCategories; var elementRecSubjCategories; elementCategory = docBook.createElement("Category"); textCategory = docBook.createTextNode(txtCategory.value); elementCategory.appendChild(textCategory); nodelistRecSubjCategories = docBook.getElementsByTagName("RecSubjCategories"); if (nodelistRecSubjCategories.length == 0) { elementRecSubjCategories = docBook.createElement("RecSubjCategories"); docBook.documentElement.appendChild(elementRecSubjCategories); } else { elementRecSubjCategories = nodelistRecSubjCategories.item(0); } elementRecSubjCategories.appendChild(elementCategory); renderElements(); } function renderElements() { document.all("divRawXML").innerText = docBook.xml; bookInfo.innerHTML = docBook.transformNode(bookXSL.documentElement); authorTable.innerHTML = docBook.transformNode(authorXSL.documentElement); categoryTable.innerHTML = docBook.transformNode(categoryXSL.documentElement); } </SCRIPT> <XML id=bookXSL> <DIV xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:choose> <xsl:when test="/Book/Title[. $ne$ '']"> <TABLE BORDER="0" CELLPADDING="1"> <TR> <TD>Title:</TD> <TD><xsl:value-of select="/Book/Title"/></TD> </TR> <TR> <TD>Publisher:</TD> <TD><xsl:value-of select="/Book/Publisher"/></TD> </TR> <TR> <TD>Published Date:</TD> <TD><xsl:value-of select="/Book/PubDate"/></TD> </TR> <TR> <TD>Abstract:</TD> <TD><xsl:value-of select="/Book/Abstract"/></TD> </TR> <TR> <TD>Pages:</TD> <TD><xsl:value-of select="/Book/Pages"/></TD> </TR> <TR> <TD>ISBN:</TD> <TD><xsl:value-of select="/Book/ISBN"/></TD> </TR> <TR> <TD>Price:</TD> <TD><xsl:value-of select="/Book/Price"/></TD> </TR> </TABLE> </xsl:when> <xsl:otherwise> Book information not yet specified. </xsl:otherwise> </xsl:choose> </DIV> </XML> <XML id=authorXSL> <DIV xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <TABLE BORDER="0" CELLSPACING="1"> <TR> <TD><STRONG>Authors</STRONG></TD> </TR> <xsl:for-each select="/Book/Authors/Author"> <TR> <TD><xsl:value-of select="text()"/></TD> </TR> </xsl:for-each> </TABLE> </DIV> </XML> <XML id=categoryXSL> <DIV xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <TABLE BORDER="0" CELLSPACING="1"> <TR> <TD><STRONG>Categories</STRONG></TD> </TR> <xsl:for-each select="/Book/RecSubjCategories/Category"> <TR> <TD><xsl:value-of select="text()"/></TD> </TR> </xsl:for-each> </TABLE> </DIV> </XML> <HR> <H2>Book information</H2> <P><DIV id=bookInfo></DIV></P> <P><DIV id=authorTable></DIV></P> <P><DIV id=categoryTable></DIV></P> <HR> The text expression of the current contents of the DOM tree is: <PRE><DIV id=divRawXML></DIV></PRE> </BODY> </HTML>если потребуется могу коментарии к коду отсканить.