Link to home
Start Free TrialLog in
Avatar of Fracture
Fracture

asked on

Onclick add/remove from array with divs


Hi all experts,

I am using ASP to loop through my customer table and dynamically create some div tags, the div id is a unique Customer ID value from the ASP.

Ive got a bit of javascript code that changes the appearance of the div on the onclick method. I would like to also during this onclick function, create an array of these customer values that i can then pass the the next page.

I dont really mind how this array is created or even if a different way might be more suitable, watever gets the selected customer id values to the next page.

Was thinking maybe

Any ideas? Im a bit rusty on my javascript syntax so however much info you can give me would be greatly appreciated.

Thanks in advance.
Fracture
Avatar of B_Dorsey
B_Dorsey

your explanation is pretty vague....

What I think you are asking is that if the user clicks to change one of the divs, you want to pass it to an array so you can (when the next page is called) use that array?

I would suggest, during the onclick, pass whatever info you want to another funciton and have that function create/recreate a cookie and then use that data on the next page.

b
Avatar of Fracture

ASKER


Hi B_Dorsey,

Yeah i've actually modified the way im doing it now. While i have you was wondering if you could help me with a different problem, should be simpler and less vague -

Im opening a new window where the user can select a customer from a grid of divs. Onclick i would like to set a textbox in the opener document to the div id value.

This is the code i currently have -

Opener window has this code -

<a href="javascript:void window.open('SearchTalent.asp?FormName=NewTalentForm', 'SearchTalent','status=yes,scrollbars=yes,toolbar=no,location=no,menu=no,maximum=no,resizable=yes,left=100,top=100,width=850,height=825');" class="btn_norm">Talent</a>

In the popup window -

onclick="Change('<%=Request("FormName")%>', '<%=gvobjTalent("TalentID")%>')"


function Change(varFormName, varValue) {

//alert(opener.document.varFormName.TalentID.value);

 window.opener.document.varFormName.TalentID.value = varValue;

 window.close();
}


But the line window.opener.document.varFormName.TalentID.value = varValue; doesnt seem to be working. The values seem to be working, i can alert them and they get there but not populating the textbox in the opener window.



Oh and the window.close() command isnt working either, and no errors...
its 11:30pm here, and this is my third all nighter in a row, chances are im delerious and missing something...

Appreciate any help.
sry just looking at this, 1 sec
ASKER CERTIFIED SOLUTION
Avatar of B_Dorsey
B_Dorsey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Hey B_Dorsey,

Yeah figured out what the problem was, looking at your code helped a great deal. The problem was my function looked like this -

   opener.document.varFormName.TalentoID.value = varValue;

When it should have looked like this -

   opener.document[varFormName].TalentoID.value = varValue;