Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   ASP with Javascript (http://www.velocityreviews.com/forums/t794178-asp-with-javascript.html)

kelvin 04-28-2004 06:59 AM

ASP with Javascript
 
Hi how do I solve this problem.

This code resides in a popup window and when the user click on the
links,
it's suppose to return the value to the main window.

However the code below doesn't work because the <a href> link does not
work at all.

Can someone help? Your help is much appreciated!


<% WHILE NOT recordset_uldType.eof %>
<tr bordercolor="#FFFFFF">
<td width="8%">
<% loc = "javascript:opener.document.forms[1].elements[11].value=" &
recordset_uldType("code") & ";self.close()" %>
<a href="<%=loc%>"> <%=recordset_uldType("code")%></a></td>
<td width="92%<%=recordset_uldType("description")%></td>
</tr>
<% recordset_uldType.movenext
Wend
%>

Evertjan. 04-28-2004 07:36 AM

Re: ASP with Javascript
 
kelvin wrote on 28 apr 2004 in microsoft.public.inetserver.asp.general:

> Hi how do I solve this problem.
>
> This code resides in a popup window and when the user click on the
> links,
> it's suppose to return the value to the main window.
>
> However the code below doesn't work because the <a href> link does not
> work at all.
>
> Can someone help? Your help is much appreciated!
>
>
> <% WHILE NOT recordset_uldType.eof %>
> <tr bordercolor="#FFFFFF">
> <td width="8%">
> <% loc =
> "javascript:opener.document.forms[1].elements[11].value=" &
> recordset_uldType("code") & ";self.close()" %>
> <a href="<%=loc%>"> <%=recordset_uldType("code")%></a></td>
> <td width="92%<%=recordset_uldType("description")%></td>
> </tr>
> <% recordset_uldType.movenext
> Wend
> %>
>


Translate this first to readable ASP:


<%
WHILE NOT recordset_uldType.eof
%>

<tr bordercolor="#FFFFFF"><td width="8%">

<%
loc ="javascript:opener.document.forms[1].elements[11].value='"
loc = loc & recordset_uldType("code") & "';self.close()"
%>

<a href="<% = loc%>">
<% = recordset_uldType("code")%>
</a>

</td><td width="92%">
<% = recordset_uldType("description")%>
</td></tr>

<%
recordset_uldType.movenext
Wend
%>

================

1 You missed 2 chars afer the 92%

2 You should have single quotes in the opener...='...'
[caring for spaces inside]

3 it all depends on the contents of your database items.

4 now temporarily change the <a..></a> part to:

<a
href="javascript:opener.document.forms[1].elements[11].value=
'XX';self.close()">
insert XX in the form element
</a>

If this does not work, you have a clientside javascript problem, not an
serverside ASP one or a database one.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Larry Bud 04-28-2004 01:49 PM

Re: ASP with Javascript
 
kelvinteh@yahoo.com (kelvin) wrote in message news:<ca7f6001.0404272259.229f366d@posting.google. com>...
> Hi how do I solve this problem.
>
> This code resides in a popup window and when the user click on the
> links,
> it's suppose to return the value to the main window.
>
> However the code below doesn't work because the <a href> link does not
> work at all.
>
> Can someone help? Your help is much appreciated!
>
>
> <% WHILE NOT recordset_uldType.eof %>
> <tr bordercolor="#FFFFFF">
> <td width="8%">
> <% loc = "javascript:opener.document.forms[1].elements[11].value=" &
> recordset_uldType("code") & ";self.close()" %>
> <a href="<%=loc%>"> <%=recordset_uldType("code")%></a></td>
> <td width="92%<%=recordset_uldType("description")%></td>
> </tr>
> <% recordset_uldType.movenext
> Wend
> %>


This should be in a javascript newsgroup. ASP has nothing to do with
your error.

Your javascript code returns the value to the 11th element in the form
of the page which opens this popup. Have you changed the original
form? Perhaps there is no 11th element, or it's not a text box.

Kelvin Teh 04-30-2004 02:39 AM

Re: ASP with Javascript
 
Thanks Evertjan! It works now.

Really thank you very much!



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT. The time now is 01:42 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.