Click to See Complete Forum and Search --> : Complicated Frames - Getting values
sathysudha
05-27-2003, 07:59 AM
Friends
I have two frames.
frame1 and frame2
In frame2 i will display all the products with one checkbox for each product.
What i need is?
when the user selects the products name in frame2.
the name of the product should come one by one in the frame1.
if the user selects more than 1 product i have to display
You have selected the following products
1. Compaq
2. HP
3. Dell
4. Pentium
That's all.
its very urgent. Can anyone help me pls?
Thanks
khalidali63
05-27-2003, 08:09 AM
frme 2 frame communication can be done using the followin syntax
parent.frameName.document.formName.elementName.value
now in your case you want a value to be printed in the one of the frames
suppose youwant to print values in frame1 ( we presume thats the name of the frame)
now if you are selecting values in a list box in the frame 2
get the value using the onchange event call of th eselect element
put a div tag in the page that is being displayed in frame1
<div id="data"></div>
and now print the value in the frame1
suppose value selected from list box is this
value = document.formName.listBoxName.options[document.formName.listBoxName.selectedIndex].value
var obj= parent.frame1.document.getElementById("data");
obj.appendChild(document.createTextNode(value));
sathysudha
05-27-2003, 08:16 AM
khalid
if you dont mind
can you tell me in frame1 what should i write
and in frame2 what should i write
Dont get angry :)
Thanks
khalidali63
05-27-2003, 08:19 AM
see if this helps you...
http://68.145.35.86/skills/javascripts/frames/ParentChildFramesInteraction.html
sathysudha
05-28-2003, 01:59 AM
Khalid
I am not able to get the checkbox value in the frame2.
Frame2:
<table>
<tr>
<td width="50%"><input type="checkbox" name="img1" value="Compaq"></td>
<td width="50%"><input type="checkbox" name="img2" value="HP"></td>
<td width="50%"><input type="checkbox" name="img3" value="Dell"></td>
</tr>
</table>
<input type=button name=but value=Add onClick="parent.frame1.getElementById('d').innerHTML = parent.frame2.img1.value">
Frame1:
<div name=d></div>
if he checks the img1 checkbox then i have to add in the frame1's div as
You have selected
1. Compaq
if he selected again the second one
then
You have selected
1. Compaq
2. HP
if he selected again the third one then
You have selected
1. Compaq
2. HP
3. Dell
Can you or anyone help me out this.
thanks
khalidali63
05-28-2003, 08:39 AM
to me it looks like this line is not correct
parent.frame1.getElementById('d').innerHTML
it chould be something like this
parent.frame1.document.getElementById('d').innerHTML
and if you have problems referencing your frames this way
use
parent.frames[frameIndex]......