I have 2 frames


in topmenu i have a drop down
when the drop down value is selected i want to refresh the bottom frame and pass the gender of the student

So here is my code this code refreshes the bottom frame

function transval()

when i try to sent the value by this code

function transval()
var sentgen=document.frm1.txtgender.value;
var bottomURL = "bottommenu.asp?gen=" + sentgen;
top.frames['bottommenu'].location.href = bottomURL;

it doesnt refresh the frame nor does it transfer the value

can someone tell me what i am doing wrong


> top.bottommenu.document.location.reload(); It should be top.frames['bottommenu'].location.reload(); . location is a property which belongs to the window object and not the document object. Plus you are confusing others by pasting two functions with the same name and different function definitions. Be a bit more concise and clear the next time.

Sorry about my code i tried to do it in two ways thats why.

Ok so now when i select a value in the drop down in the top frame it refreshes the bottom frame with the code that you gave me

Can you tell me how i can sent a variable to the bottom frame and also refresh the bottom frame

I want to sent a variable that holds gender of the student to the bottom frame

Again thanks for all your help



I tried this code to refresh the frame and also pass the gender value

var bottomURL = "bottommenu.asp?gen=" + sentgen;
top.frames['bottommenu'].location.href = bottomURL;

but the frame refresh doesnt happen and also the variable is not passed

Can you tell me what i am doing wrong


Use the replace function of the location object.

Try top.frames['bottom'].location.replace(bottomURL); or top.frames['bottom'].location.assign(bottomURL);

Thanks for your reply.

I tried both codes it didnt work

you had

top.frames['bottom'].location.replace(bottomURL); or top.frames['bottom'].location.assign(bottomURL);

i changed it to the code as displayed belowed as bottommenu is the name of the frame

top.frames['bottommenu'].location.replace(bottomURL); or top.frames['bottommenu'].location.assign(bottomURL);

below is how my frames look like

<frameset rows="75%,*">
<frame name="topmenu" id="topmenu" src="topmenu.asp">
<frame name="bottommenu" id="bottommenu" src="bottommenu.asp">

this is driving me nuts with this frame thing



I have this page called one.asp

<frameset rows="75%,*">
<frame name="topmenu" id="topmenu" src="topmenu.asp?id=<%=getmainid%>">
<frame name="bottommenu" id="bottommenu" src="bottommenu.asp?id=<%=getmainid%>">

So then you see a page who has 2 frames

in the topmenu.asp there is a drop down which has students name
then when you select the name it will display the score for the athlete in top frame

and then in bottom frame it will rank the athlete for his gender

so if u select a male it will show where you rank as compared to other males in the bottom frame

so for me to make that ranking happen i have to transfer the gender to the bottom frame when the
value in drop down is selected

so here is my code

Dim getid

<title>Athletes Scores</title>
<script type="text/javascript">
function changedropnameath()
var getnder=document.frm1.getnewstgen.value;

var bottomURL = "bottommenu.asp?gen=" + getnder;


// -->

<body >
<form name="frm1" id="frm1" method="post">

Name: <select name="ath" id="ath" size="1" onChange="this.form.action = '<%=Request.ServerVariables("Script_Name") &"?id=" & getid%>'; this.form.submit(); changedropnameath();">
<option value="">Select a Name</option>
Set rstsub = Server.CreateObject("adodb.RecordSet")
strsql="Select * from students order by Lname"
rstsub.Open strsql,Conn, 2, 2
If Not rstsub.eof Then
Do While Not rstsub.eof
<option <%if Trim(rstsub("Id"))=Trim(Request.Form("ath")) then Response.Write "selected" end if%> value=<%=rstsub("Id")%>><%=rstsub("Name")%></option>

End if
Set rstsub = Nothing


If getathid <> "" then

Set rsgetath = Server.CreateObject("adodb.RecordSet")
strgetath="Select * from studentsscore where Id='" & getathid & "' and Main_Id='" &getid& "'"
rsgetath.Open strgetath,Conn, 2, 2

<input type="hidden" name="getnewstgen" value="<%=getnewstgen%>"/>
End if

so i found out what the problem is

when you select the value in drop down page is refreshed it finds out the details for the student and
it saves the gender of student in the hidden field

But now say there are 2 students

John Smith
Rachel Doe

When you select John smith for first time in drop down his gender is not there in the hidden field
can someone tell me whats the best way of doing it

if i can get the value of gender in javascript function then i am good to go and the code will work

any ideas


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.