User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,515 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,766 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3681 | Replies: 6
Reply
Join Date: Oct 2007
Posts: 8
Reputation: todd2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
todd2006 todd2006 is offline Offline
Newbie Poster

pass value to frame as well as refresh the frame

  #1  
Oct 1st, 2007
Hi,

I have 2 frames

Topmenu
bottommenu

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()
{
	top.bottommenu.document.location.reload();
}


when i try to sent the value by this code

function transval()
{
var sentgen=document.frm1.txtgender.value;
alert(sentgen);
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

todd
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: pass value to frame as well as refresh the frame

  #2  
Oct 2nd, 2007
> 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.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Oct 2007
Posts: 8
Reputation: todd2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
todd2006 todd2006 is offline Offline
Newbie Poster

Re: pass value to frame as well as refresh the frame

  #3  
Oct 2nd, 2007
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

todd
Reply With Quote  
Join Date: Oct 2007
Posts: 8
Reputation: todd2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
todd2006 todd2006 is offline Offline
Newbie Poster

Re: pass value to frame as well as refresh the frame

  #4  
Oct 2nd, 2007
Hello,

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

todd
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: pass value to frame as well as refresh the frame

  #5  
Oct 2nd, 2007
Use the replace function of the location object.

Try top.frames['bottom'].location.replace(bottomURL); or top.frames['bottom'].location.assign(bottomURL);
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Oct 2007
Posts: 8
Reputation: todd2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
todd2006 todd2006 is offline Offline
Newbie Poster

Re: pass value to frame as well as refresh the frame

  #6  
Oct 2nd, 2007
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">
</frameset>

this is driving me nuts with this frame thing

todd
Reply With Quote  
Join Date: Oct 2007
Posts: 8
Reputation: todd2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
todd2006 todd2006 is offline Offline
Newbie Poster

Re: pass value to frame as well as refresh the frame

  #7  
Oct 2nd, 2007
Hi,

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%>">
</frameset>

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
getid=Trim(Request.querystring("id"))
%>

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

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

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


// -->
</script>


</head>
<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>
<%
rstsub.MoveNext()
Loop

End if
rstsub.Close
Set rstsub = Nothing
%>
</select>

<%
getathid=Trim(Request.Form("ath"))

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
getnewstgen=rsgetath("Gender")

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

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

todd
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:58 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC