I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the textbox value in the main page is undefined
----------------------------------------
here are code main page:
-------------------------------------------
[HTML]<script language="JavaScript">
var thedata;
var newwin;
var thenumber;
function edit(textarea)
{
if (textarea == 0)
{
thedata = document.frmXuly.hanhvi.value
thenumber = 0
}
newwin = window.open("hanhvi.htm","","width=800,height=600, resizable")
}
</script>
<html>
<body>
<table>
<tr>
<td width="78%" valign="top"> <fieldset name="Group1" style="width: 362px">
<font size="2">
<legend>Hành vi vi phạm</legend>
<textarea id="hanhvi" name="hanhvi" cols="65" rows="6"></textarea>
</font></fieldset></td>
<td width="22%"> <p>
<input name="button" type="button" onclick="edit(0)" value="Open">
</p></td>
</tr>
</table>
</body>
</html>[/HTML]
-------------------------------------------
here are code popup page:
--------------------------------------------
[HTML]<HTML>
<HEAD>
<TITLE>Tra cứu hành vi vi phạm</TITLE>
<STYLE>
.catalog_genre_head {background-color:darkGreen;font-size:16pt;color:white;font-family:Impact;}
.catalog_head {background-color:green;font-size:13pt;color:white;font-family:Impact;}
.catalog_row0 {background-color:lightGreen;font-size:13pt;}
.catalog_row1 {background-color:white;font-size:13pt;}
.catalog_row_end {background-color:darkGreen;}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript">
var whichone;
function writedata()
{
whichone = opener.thenumber
document.frm_hanhvi.data.value = opener.thedata
}
function updateit()
{
if (whichone == 0) {
opener.document.frmXuly.hanhvi.value = document.frm_hanhvi.data.value
}
window.close()
}
</script>
</HEAD>
<BODY onload="writedata()">
<form method="post" name="frm_hanhvi">
<H2>TRA CỨU HÀNH VI</H2>
<DIV id="catalog_table"></DIV>
<xml id="book_catalog" src="hanhvi.xml">
</xml>
<xml id="catalog_filter">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
version="1.0">
<xslaram name="selected_genre" select="'all'"/>
<xsl:template match="/">
<div> Chọn lĩnh vực:
<select name="genre" value="{$selected_genre}" onchange="showGenre(this.value)">
<option value="all"><xsl:if test="$selected_genre='all'"><xsl:attribute name="selected">Selected</xsl:attribute></xsl:if>All</option>
<option value="dlcl"><xsl:if test="$selected_genre='dlcl'"><xsl:attribute name="selected">Selected</xsl:attribute></xsl:if>Đo lường chất lượng</option>
<option value="shtt"><xsl:if test="$selected_genre='shtt'"><xsl:attribute name="selected">Selected</xsl:attribute></xsl:if>Sở hữu trí tuệ</option>
<option value="atbx"><xsl:if test="$selected_genre='atbx'"><xsl:attribute name="selected">Selected</xsl:attribute></xsl:if>An ṭan và kiểm sóat bức xạ</option>
<option value="cgcn"><xsl:if test="$selected_genre='cgcn'"><xsl:attribute name="selected">Selected</xsl:attribute></xsl:if>Chuyển giao công nghệ</option>
</select>
<br/>
<xsl:apply-templates select="catalog"/>
</div>
</xsl:template>
<xsl:template match="catalog">
<table class="catalog_table">
<xsl:apply-templates select="hanh_vi[($selected_genre='all') or ($selected_genre=./genre)]">
<xsl:sort select="title"/>
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="hanh_vi">
<xsl:if test="position()=1">
<tr class="catalog_genre_head">
<td colspan="6"> <xsl:choose> <xsl:when test="$selected_genre='all'"> Tất
cả lĩnh vực</xsl:when> <xsltherwise> Lĩnh vực: <xsl:value-of select="genre"/>
</xsltherwise> </xsl:choose> </td>
</tr>
<tr class="catalog_head">
<td>#</td>
<td>Hành vi </td>
<td>Văn bản</td>
<td>Ngày có hiệu lực</td>
<td>Chi tiết</td>
<td></td>
</tr>
</xsl:if>
<tr class="catalog_row{position() mod 2}">
<td>
<xsl:value-of select="position()"/>
</td>
<td class="catalog_cell"><xsl:value-of select="title"/></td>
<td class="catalog_cell"><xsl:value-of select="author"/></td>
<td class="catalog_cell"><xsl:value-of select="publish_date"/></td>
<td class="catalog_cell">
<textarea cols="40" rows="6" id="data" name="textarea">
<xsl:value-of select="description"/>
</textarea>
</td>
<td><input name="button" type="button" onClick="updateit()" value="Save" /></td>
</tr>
<xsl:if test="position()=last()">
<tr class="catalog_row_end"><td colspan="6"> </td></tr>
</xsl:if> </xsl:template> </xsl:stylesheet> </xml>
<SCRIPT language="JavaScript">
function loadSource(sourceObj){
var xmlDoc=new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0" );
xmlDoc.async=false;
xmlDoc.load(sourceObj.XMLDocument);
return xmlDoc;
}
var table_proc=null;
function getProcessor(transformObj){
if (table_proc==null){
var xslDoc=new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0" );
var xslTemplate=new ActiveXObject("Msxml2.XSLTemplate.5.0");
xslDoc.async=false;
xslDoc.load(transformObj.XMLDocument);
xslTemplate.stylesheet=xslDoc;
xslProcessor=xslTemplate.createProcessor();
table_proc=xslProcessor;
}
else {
xslProcessor=table_proc;
}
return xslProcessor;
}
function transformData(srcDoc,processor){
var resultDoc=new ActiveXObject("MSXML.DOMDocument");
processor.input=srcDoc;
processor.output=resultDoc;
processor.transform();
return resultDoc;
}
function showGenre(genre){
var srcDoc=loadSource(book_catalog);
var processor=getProcessor(catalog_filter);
processor.addParameter("selected_genre",genre);
var rsltDoc=transformData(srcDoc,processor);
catalog_table.innerHTML=rsltDoc.xml
}
showGenre("all");
</SCRIPT>
</form>
</BODY>
</HTML>[/HTML]
---------------------------------------------------
Here are xml file hanhvi.xml (popup page)
---------------------------------------------------
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0"?>
- <catalog>
- <hanh_vi id="bk101">
- <title>Danh mục phương tiện đo phải kiểm định do Bộ Khoa học và </title>
- <author>Nghị định 59/2007 CP</author>
- <genre>dlcl</genre>
- <publish_date>10-10-2000</publish_date>
- <descriptionvới phương tiện đo khi xuất bán. </description>
- </hanh_vi>
- <hanh_vi id="bk101">
- <title>Danh mục phương tiện đo phải kiểm định do Bộ Khoa học và </title>
- <author>Nghị định 59/2007 CP</author>
- <genre>dlcl</genre>
- <publish_date>10-10-2000</publish_date>
- <descriptionvới phương tiện đo khi xuất bán. </description>
- </hanh_vi>
- <hanh_vi id="bk102">
- <title>Hành vi vi phạm quy định về thủ tục xác lập, thực hiện và bảo vệ quyền sở hữu công nghiệp</title>
- <author>Luật Sở hữu TT</author>
- <genre>shtt</genre>
- <publish_date>2000-12-16</publish_date>
- <description>(hữu công nghiệp;</description>
- </hanh_vi>
- <hanh_vi id="bk106">
- <title>Hành vi vi phạm quyền sở hữu trong chuyển giao công nghệ</title>
- <author>Luật chuyển giao công nghệ</author>
- <genre>cgcn</genre>
- <publish_date>2000-09-02</publish_date>
- <descriptionuỷ quyền chuyển giao quyền sử dụng công nghệ và gây thiệt hại cho bên nhận công nghệ.</description>
- </hanh_vi>
- <hanh_vi id="bk107">
- <title>Hành vi lợi dụng quyết định phê duyệt hợp đồng chuyển giao công nghệ</title>
- <author>Nghị định 61/CP</author>
- <genre>cgcn</genre>
- <publish_date>2000-11-02</publish_date>
- <description>(Khoản1, Điều 6) đối với hành vi lợi dụng quyết định phê duyệt hợp .</description>
- </hanh_vi>
- <hanh_vi id="bk108">
- <title>Hành vi vi phạm quy định về khai báo</title>
- <author>Thông tư 05/TT-BKHCN</author>
- <genre>atbx</genre>
- <publish_date>2000-12-06</publish_date>
- <descriptionKhông khai báo khi tiến hành các công việc bức xạ.</description>
- </hanh_vi>
- </catalog>
Please help me fix this error
Thank's verry much
i am waiting...........for help