Problem with ASP/Javascript coding with frames and "top.parent"



I am fixing a client's Web site and I do not have the time to reprogram
things my way, and the last hurdle I have is with a piece of javascript
embedded in an ASP snippet.

The payment form is named "frmPayment". The page itself is in a frame
named "main".

The form contains 1 or many items. The amount of each item can be
modified from a drop down (this is for a classified ads system, you can
select a different ad type per ad) and the grand total is changed.

Next to each drop down, is a textbox named textbox0, textbox1, etc...

When a different value is selected in a drop-down, a piece of ASP is
fired in another, invisible frame, named "process".

top.parent.process.location.href = 'process_setadcost.asp?IDX=' + idx +
'&AdTypeID=' + val;

This ASP first retrieves the ad cost into adCost by using the value
passed in AdTypeID. (So far, it works. Pretty exotic technique).

The following code is supposed to update txtAdCost[idx], redo the total
and change the value in the total field, which is then used in the
following page (credit card auth).
-----------------
<%
Dim pintIDX
pintIDX = Request("IDX")
%>
<HTML>
<HEAD>
<script language="javascript">
var adCost = '<%=AD.GetAdCost()%>';
var total = 0;
var f = top.parent.main.document.frmPayment;

f.txtAdCost<%=pintIDX%>.value = adCost;

var uBound = f.UBOUND.value;
var loopAdCost = 0;
for (i = 0; i <= uBound-1; i++) {
loopAdCost = f['txtAdCost' + i].value;

if (loopAdCost == '') {
loopAdCost = 0;
}
total = total + eval(loopAdCost);
}
f.AMT.value = total;
</script>
</HEAD>
<BODY>

-----------------

var adCost = '<%=AD.GetAdCost()%>'; works fine. The ASP uses the
GetAdCost subclass and no problem there.

I keep getting the error message: 'f.txtAdCost0' is null or is not an
object.

When I replace the "f" with "top.parent.main.document.frmPayment", it
tells me that 'top.parent.main.document.frmPayment.txtAdCost0' is null
or is not an object.

Obviously, it is not using the right handler to instantiate the form
into "f".

I have tried all types of solutions. I cannot reprogram it all, the
client does not have the time nor the money, and I don't have the time
redesign this Web site from the ground up.

Thanks for your help, guys, I have tried everything for hours and gave
myself a major headache on this one!

Note that all the other ASP codes loaded in the "process" frame work
fine.

.



Relevant Pages

  • Re: SQL beginner help
    ... statements to the server)? ... request from the "jblow123" web site login. ... with the Asp code it will decide what how to handle what the user is ... But I still need some client side execution;/ I think I got a good ...
    (microsoft.public.sqlserver)
  • Re: My first impressions of ASP.NET
    ... is responsible for the delivery of vital aircraft parts to active duty US ... ASP trick of storing the variable in an hidden text box. ... > sure what Afghanistan has to do with this. ... >> with DoD regulations to replace the existing Web Site which was working ...
    (microsoft.public.dotnet.general)
  • Re: My first impressions of ASP.NET
    ... > Our company built a web site for the US Navy using ASP. ... > Our ASP web site consisted of 2200 pages after it was partially complete. ... > We have 4 programmers to maintain these pages. ... However after the deployment of ...
    (microsoft.public.dotnet.general)
  • Re: Trouble getting started with FP & Access
    ... I figured it out with some help from a web site at ... > write some ASP code of my own. ... In the book, in the section titled "connecting to a database", ... > I read about the DNS and it said that "The data source ...
    (microsoft.public.frontpage.programming)
  • Dont understand flow using xmlhttp
    ... I'm building a simple newsletter application using Classic ASP. ... loop through the array and for each e-mail address do a http ... Is there a way of not continuing the loop until the response has ... var aList = new Array; ...
    (comp.lang.javascript)