Coldfusion and javascript - window open reference
What's wrong with my code ?
My First code did not receive value from my 2nd code. Anyone can help ?
TQ.
1st cfm code:
<cfquery name="q_1" datasource="#dsn#">
select * from persontbl</cfquery>
<body>
<p> </p>
<form name="stockForm>">
<table width="100%" border="1">
<tr bgcolor="#CCCCCC">
<td width="18%"><strong>Bil</strong></td>
<td width="44%"><strong>Nama</strong></td>
<td width="38%"><strong>Text</strong></td>
</tr>
<cfset i="0">
<cfoutput query="q_1">
<SCRIPT LANGUAGE="JavaScript">
<!--
function showList(i) {
var site = 'stocklist.cfm?x='+i
sList = window.open(site, "list", "width=300,height=500");
<!--- sList = window.location.href="stocklist.html"; --->
}
function remLink() {
if (window.sList && window.sList.open && !window.sList.closed)
window.sList.opener = null;
}
// -->
</SCRIPT>
<cfset i = i+1>
<tr>
<td>#q_1.currentrow#</td>
<td>#q_1.PER_NAME#</td>
<td><input name="stockBox[i]" type="text" class="L">
<span class="text">
<INPUT TYPE="button" class="L" onClick="showList(#i#)" VALUE="Simpan">
</span></td>
</tr>
</cfoutput>
<tr>
<td colspan="3" align="right"></td>
</tr>
</table>
</form>
</body>
2nd cfm code.
<SCRIPT LANGUAGE="JavaScript">
<!--
function pick(symbol,y) {
if (window.opener && !window.opener.closed)
window.opener.document.stockForm.stockBox[y].value = symbol;
window.close();
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="5">
<TR BGCOLOR="cccccc">
<TD><B>NYSE</B></TD>
<TD><B>NASDAQ</B></TD>
</TR>
<TR>
<TD><A HREF="javascript:pick('AOL',<cfoutput>#x#)</cfoutput>">AOL</A></TD>
<TD><A HREF="javascript:pick('CSCO',<cfoutput>#x#)</cfoutput>)">CSCO</A></TD>
</TR>
<TR>
<TD><A HREF="javascript:pick('CPQ',<cfoutput>#x#)</cfoutput>)">CPQ</A></TD>
<TD><A HREF="javascript:pick('INTC',<cfoutput>#x#)</cfoutput>)">INTC</A></TD>
</TR>
</TABLE>
Comments
post this in a forum
You must me logged in to write a comment.