Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

javascript window transfer

Posted on 2001-08-14
13
Medium Priority
?
847 Views
Last Modified: 2008-03-03
I have an iframe sitting on a page. when I click on a link I would like the information about the url of the iframe to be passed along with the page info. is there javascript that can accomplish that?

something like this:

function processForm(theForm, theURL, windowName, features) {
    var dest = "";
    var newURL = theURL;

    dest = document.ratesform.destination[document.ratesform.destination.selectedIndex].value;
    newURL = theURL + "?destination=" + escape(dest);
    window.open(newURL, windowName, features);
    return false;
}
0
Comment
Question by:kaarsenmaker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 14

Expert Comment

by:avner
ID: 6385475
Like this ? :

function processForm(theForm, theURL, windowName, features) {
   var dest = "";
   var newURL = theURL;

   dest = document.ratesform.destination[document.ratesform.destination.selectedIndex].value;
   newURL = theURL + "?destination=" + escape(dest)+"&URL="+theURL;
   window.open(newURL, windowName, features);
   return false;
}

notice the added URL value pair
0
 

Author Comment

by:kaarsenmaker
ID: 6385523
from outside the iframe I need to get the URL of the iframe and pass it through as a parameter. This example is similar to what I want to but it doesnt show me how to get the url of the contents of the iframe.
0
 
LVL 14

Expert Comment

by:avner
ID: 6385531
To get the URL of the contents of the IFrame just use :

document.all.iframeid.src

for example:

<BODY onload="alert(document.all.moshe.src)">

<IFRAME id="moshe" src="http://www.yahoo.com"></IFRAME>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kaarsenmaker
ID: 6385681
this is what I have on my page, it pops up a window on IE both on the MAc and PC, but it will not work on Netscape, why?


<script language="JavaScript">

<!--
function processForm() {
    var dest = document.all.causes_iframe.src;
    alert(dest);
    return false;
}
//-->
</script>
0
 
LVL 14

Expert Comment

by:avner
ID: 6385687
document.all dosen;t work in NS.
IFRAME also won't work in Netscape.

You should try and use ILAYER instead for NS. But you are getting into a complicated CrossBrowsers issue.
0
 

Author Comment

by:kaarsenmaker
ID: 6385699
iframes work in Netscape 6, this pop up doesnt work in Netscape 6. is there something like document.all that does work in netscape and IE?
0
 
LVL 14

Expert Comment

by:avner
ID: 6385724
Oh ... I thought you were talking about NS4.x.

Please ignore the previous comment.

Anyway , to do this in NS6 try :

document.getElementById("causes_iframe").src
0
 

Author Comment

by:kaarsenmaker
ID: 6385746
that one didnt work either:

<script language="JavaScript">

<!--
function processForm() {
    var dest = document.getElementById("causes_iframe").src;
    alert(dest);
    return false;
}
//-->
</script>
0
 

Author Comment

by:kaarsenmaker
ID: 6385788
this last solution doesnt work in IE either, the other one worked in IE
0
 
LVL 14

Accepted Solution

by:
avner earned 1200 total points
ID: 6385805
This works in both IE5 and NS 6 :

<script language="JavaScript">
<!--
function processForm() {
   var dest=document.getElementById("causes_iframe").src
   alert(dest);
   return false;
}
//-->
</script>
<iframe src="http://www.yahoo.com" name="causes_iframe" id="causes_iframe"></iframe>

<script>setTimeout("processForm()",1000)</script>
0
 

Author Comment

by:kaarsenmaker
ID: 6385849
you the man avner,

I was missing the id tag on the iframe. I am increasing your point total to 400 because you were so patient and you hit the nail right on the head. go ask your boss for a raise cause you are most defintiely on your game today.
0
 

Author Comment

by:kaarsenmaker
ID: 6385899
sorry the module would only allow me to increase to 300
0
 
LVL 14

Expert Comment

by:avner
ID: 6385958
kaarsenmaker ,
Thank you .
This is the kind of comments that inject the fuel to helping other developers.
Always happy to help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question