• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

frame

Dear all,
How get passed Parameter to parent window from inside frame?

0
ethar1
Asked:
ethar1
  • 3
  • 3
1 Solution
 
ZylochCommented:
Hi

Can you elaborate a little? Are you passing a variable that is inside the frame to the parent? Or do you want a variable that was set in the parent window? If the latter, you can use parent.variableName.

Regards,
Zyloch
0
 
ethar1Author Commented:
I want a variable that was "SENT" to the parent window

http://xx.com/x.asp?param1=t


I want to get param1 from frame window.
Thanks
0
 
ZylochCommented:
Sure. Do this:

var paramName = "param1";

var param = parent.location.href.split("?")[1].split("&");
for (var i=0;i<param.length;i++) {
   if (param[i].indexOf(paramName)!=-1) {
      param = param[i].split("=")[1];
   }
}

Now, if the param was sent, variable param should equal whatever is after param1. (Of course, you might have to change paramName.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
ethar1Author Commented:
Thanks very much
0
 
ethar1Author Commented:
This is answer my question perfectly, but I have one more question,
the value now stored in javascript , how can pass it to asp code?
Thanks.
0
 
ZylochCommented:
You have to refresh the page and attach it to the end of your URL in the frame. That's the only way, then you can pick it out with ASP. For instance:

self.location=self.location.href+param;

Then grab it out of the URL with ASP.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now