Passing JScript array to another web page 
Author Message
 Passing JScript array to another web page

I have an .asp page which basically lists records from an ADO record set
in a table.  When a row of the table is clicked, on the screen I
highlight the row.  I then use the push() method of an array to add the
row object to the array.  My aim is to let the user highlight more than
one row and then click on a link (e. g. delete) to act on all the
highlighted rows.  Highlighting the rows and putting their objects into
the array is working properly except for some issues with unhighlighting
some rows.  

Once I have this array with one or more objects in it, I need to somehow
pass the JScript array to another page which will list the items
highlighted and ask the user to confirm the action.  How can I pass the
array?  Here is the Script I am using, pared down to show the relevant
parts.  This script has been set to the onClick event of the <TR> tag of
the table.

<script language="JavaScript">

        var highlightedRows = new Array();

        function highlight(objRow) {

                //Add the row to the array
                highlightedRows.push(objRow);                  

                //Highlight the row
                objRow.style.backgroundColor = "#90bff4";
        }

</script>

The <TR> tag appears as follows:

<tr id="Row100">
        <td class="clsItem" width="40%" onClick="highlight(Row100)">Text
</td>
</tr>

When the item is clicked the highlight function is called with the id of
the <tr>.  That object is added to the array.

When the delete (or other links) are clicked I want to act upon all the
rows in the array.  How can I pass that array to another page?

The number of rows selected will be small, typically less than 20.

Does this make sense?

Thanks,

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Sun, 10 Apr 2005 23:39:34 GMT  
 Passing JScript array to another web page


Quote:
> I have an .asp page which basically lists records from an ADO record set
> in a table.  When a row of the table is clicked, on the screen I
> highlight the row.  I then use the push() method of an array to add the
> row object to the array.  My aim is to let the user highlight more than
> one row and then click on a link (e. g. delete) to act on all the
> highlighted rows.  Highlighting the rows and putting their objects into
> the array is working properly except for some issues with unhighlighting
> some rows.

> Once I have this array with one or more objects in it, I need to somehow
> pass the JScript array to another page which will list the items
> highlighted and ask the user to confirm the action.  How can I pass the
> array?  Here is the Script I am using, pared down to show the relevant
> parts.  This script has been set to the onClick event of the <TR> tag of
> the table.

> <script language="JavaScript">

> var highlightedRows = new Array();

> function highlight(objRow) {

>         //Add the row to the array
> highlightedRows.push(objRow);

>         //Highlight the row
> objRow.style.backgroundColor = "#90bff4";
> }

> </script>

> The <TR> tag appears as follows:

> <tr id="Row100">
>     <td class="clsItem" width="40%" onClick="highlight(Row100)">Text
> </td>
> </tr>

> When the item is clicked the highlight function is called with the id of
> the <tr>.  That object is added to the array.

> When the delete (or other links) are clicked I want to act upon all the
> rows in the array.  How can I pass that array to another page?

> The number of rows selected will be small, typically less than 20.

> Does this make sense?

> Thanks,

> Chris

Array.toString gives elements as comma delimited string e.g:
1,5,7,2,6
pass this string in the url or post it by setting a hidden field to its
value:
with get: window.location = myProcessingPage.asp?ids=1,5,7,2,6
with post: document.forms[0].myHiddenElement.value = "1,5,7,2,6";
document.forms[0].submit();

Joe



Mon, 11 Apr 2005 00:48:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. pass a form from web page to web page

2. Passing variables from one web page to another web page using JavaScript

3. pass a form from web page to web page

4. How to pass an n-dim array from VBScript to JScript within an ASP page

5. Passing Server Array to Client JScript

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

7. Passing arrays to COM java objects from JScript (Server Side)

8. Passing Array from JScript to COM Server

9. How to pass Jscript arrays to ActiveX objects?

10. Passing Array from JScript to COM Server

11. Passing Arrays from jscript to c#

12. passing jscript arrays TO Automation servers

 

 
Powered by phpBB® Forum Software