By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Please help me! I Submit a popup, return textarea in the main page is undefined

P: 1
Please help me....
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
  1. <?xml version="1.0"?>
  2. <catalog>
  3. <hanh_vi id="bk101">
  4. <title>Danh mục phương tiện đo phải kiểm định do Bộ Khoa học và </title>
  5. <author>Nghị định 59/2007 CP</author>
  6. <genre>dlcl</genre>
  7. <publish_date>10-10-2000</publish_date>
  8. <descriptionvới phương tiện đo khi xuất bán. </description>
  9. </hanh_vi>
  10. <hanh_vi id="bk101">
  11. <title>Danh mục phương tiện đo phải kiểm định do Bộ Khoa học và </title>
  12. <author>Nghị định 59/2007 CP</author>
  13. <genre>dlcl</genre>
  14. <publish_date>10-10-2000</publish_date>
  15. <descriptionvới phương tiện đo khi xuất bán. </description>
  16. </hanh_vi>
  17. <hanh_vi id="bk102">
  18. <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>
  19. <author>Luật Sở hữu TT</author>
  20. <genre>shtt</genre>
  21. <publish_date>2000-12-16</publish_date>
  22. <description>(hữu công nghiệp;</description>
  23. </hanh_vi>
  24.  
  25. <hanh_vi id="bk106">
  26. <title>Hành vi vi phạm quyền sở hữu trong chuyển giao công nghệ</title>
  27. <author>Luật chuyển giao công nghệ</author>
  28. <genre>cgcn</genre>
  29. <publish_date>2000-09-02</publish_date>
  30. <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>
  31. </hanh_vi>
  32. <hanh_vi id="bk107">
  33. <title>Hành vi lợi dụng quyết định phê duyệt hợp đồng chuyển giao công nghệ</title>
  34. <author>Nghị định 61/CP</author>
  35. <genre>cgcn</genre>
  36. <publish_date>2000-11-02</publish_date>
  37. <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>
  38. </hanh_vi>
  39. <hanh_vi id="bk108">
  40. <title>Hành vi vi phạm quy định về khai báo</title>
  41. <author>Thông tư 05/TT-BKHCN</author>
  42. <genre>atbx</genre>
  43. <publish_date>2000-12-06</publish_date>
  44. <descriptionKhông khai báo khi tiến hành các công việc bức xạ.</description>
  45. </hanh_vi>
  46.  
  47. </catalog>
-----------------------------------------------
Please help me fix this error
Thank's verry much
i am waiting...........for help
Sep 18 '07 #1
Share this Question
Share on Google+
2 Replies


gits
Expert Mod 5K+
P: 5,235
hi thuythu,

welcome to TSDN ...

please use the code tags when posting code ...

kind regards
Sep 18 '07 #2

gits
Expert Mod 5K+
P: 5,235
hi ...

for textareas don't use value ... use innerHTML instead ...

kind regards
Sep 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.