Funny passing a text string from a database field to a Javascript global array 
Author Message
 Funny passing a text string from a database field to a Javascript global array

  Hello all, I've had a rather perplexing problem with some javascript/ASP:
I have created a frameset where I have initialised a number of global


<script language="javascript">

var showprice = new Array();
var recordnumber = new Array();
var itemname = new Array();
var itemcode = new Array();

var totalrecordcount;


<frameset border="0" frameborder="0" rows="0%,100%">
  <frame src="ASPblank.html">
  <frame src="ASPfromweb3.asp">

Now, in the file ASPfromweb3.asp I pass values to the above variables
through a dociment.write command, part of which is:

+ '<form action="ASPviewbasket.asp" target=_self method=POST onsubmit='
+ 'top.showprice[<%=intNumRecs%>]'
+ '='
+ items[<%=intNumRecs%>].prprice
+ ','
+ 'top.recordnumber[<%=intNumRecs%>]'
+ '='
+ <%=intNumRecs%>
+ ','
+ 'top.itemname[<%=intNumRecs%>]'
+ '='
+ items[<%=intNumRecs%>].prname
+ '>'


Now, looking at the above code, the
top.showprice[<%=intNumRecs%>]=items[<%=intNumRecs%>].price has no problem
returning the number value from the database record. However when I try to
pass a text string through:
top.itemname[<%=intNumRecs%>]=items[<%=intNumRecs%>].prname I get a
"software" not defined error the moment you click on the submit button. This
happens whenever it encounters a text string. I was under the impression
that you did not have to declare variable types (as in C) - am I doing
something obviously wrong (I'm sure it's staring at me in the face).

Please help if you can. Kind regards George Pantela.

Tue, 10 Jul 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Passing String arrays from Java to JavaScript ?

2. Searching for a string in a database field

3. Entering vast amont of text into memo-field of access-database (on server)

4. Error writing text field from database

5. MEMO FIELDS - displaying as string text

6. Passing Array of string to component

7. Passing array of strings from ASP (JScript) to ATL COM

8. Passing Array of Java Strings to VBScript

9. Pass javascript array to a ASP recordset

10. Passing arrays from javascript to a java applets

11. Passing Arrays ASP to Javascript

12. passing array from javascript to vbscript


Powered by phpBB® Forum Software