Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7915231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:23:18+00:00 2026-06-03T14:23:18+00:00

I am trying to achieve 2 things with the href links below. First, I

  • 0

I am trying to achieve 2 things with the href links below. First, I would like to fire-up a pop up window. Done. Next, I would like that pop up window to display an iframe. This was easily accomplished as well until I realized I needed to pass the href link text as a parameter in my iframe src.

So for example, the iframe wont load in my pop up window unless its src="http://localhost:8080/test/document.html?OnSale"

I cannot figure out why the document.write in the body of my html page won’t print out the dynamic iframe Im trying to create with my foo() function in the href links…

<div id="blanket" style="display:none;"></div>
    <div id="popUpDiv" style="display:none;">
        <a href="#"  onclick="popup('popUpDiv')">
            <img align="right" src="http://localhost:8080/test/img/close_img.png">
        </a>
<script type="text/javascript"> 
    function foo(obj)
    {
        test1 = "http://localhost:8080/test/document.html?"+obj.text; 
        document.write('<iframe height="450"  allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');
    } 
</div>

<a href="#" onclick="popup('popUpDiv');foo(this);">OnSale</a>

EDIT:
Here is my full html page. Everything is running locally on tomcat7 w/ win7 and firefox.

<html>
<head>
    <script type="text/javascript" src="http://localhost:8080/test/css-popup/css-pop.js"></script>
    <link href="http://localhost:8080/test/css-popup/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
    <a href="#"  onclick="popup('popUpDiv')">
        <img align="right" src="http://localhost:8080/test/css-popup/x.png">
    </a>
    <script type="text/javascript">
        function foo(obj){
            test1 = "http://localhost:8080/test/document.html?"+obj.innerHTML;
            document.write('<iframe height="450"  allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');

        }
    </script>
</div>

<a href="#" onclick="popup('popUpDiv');foo(this);">OnSale</a>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:23:19+00:00Added an answer on June 3, 2026 at 2:23 pm

    text is not a standard for all browsers, try innerHTML instead of that,

    function foo(obj){
         test1 = "http://localhost:8080/test/document.html?"+obj.innerHTML; 
         document.write('<iframe height="450"  allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');
    }
    

    UPDATED after you had shared your whole code,

    As I understand you want to open a popup window, and show an dynamically created iframe in it. But document.write works for your current window. So you have to handle your popup window at first. then change content of that.

    try this,

    <html>
    <head>
    <script type="text/javascript" src="http://localhost:8080/test/css-popup/css-pop.js"></script>
    <link href="http://localhost:8080/test/css-popup/styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    
    
    <div id="blanket" style="display:none;"></div>
        <div id="popUpDiv" style="display:none;">
            <a href="#"  onclick="popup('popUpDiv')">
                <img align="right" src="http://localhost:8080/test/css-popup/x.png">
            </a>
    <script type="text/javascript"> 
        var popUpWindow;
        function popup(n) {
           popUpWindow = window.open(n);
        }
                    function foo(obj){
                    test1 = "http://localhost:8080/test/document.html?"+obj.innerHTML; 
                    popUpWindow.document.write('<iframe height="450" allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');
    
                    } 
            </script>
    </div>
    
            <a href="#" onclick="popup('popUpDiv');foo(this);">OnSale</a>
    
    </body>
    </html>​
    

    And here is working live DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

And here I am, wasting my time trying to achieve things that would take
I'm trying to achieve two things, both of which I fail to get at.
Two things I'm trying to achieve and need help with 1) Click a link
What I am trying to achieve is something like this: class object: def __init__(self):
So I'm trying to achieve an affect like the native cropper when you use
I am trying to achieve something roughly as follows: /* I assume that we
in my application, i'm trying to achieve something like this: i have: data 0,
I have a JQuery Accordion as below; <div id=accordion> <h3 class=ui-accordion-header><a id=link1 href=#>First Header</a></h3>
I am trying to achieve following things: To create subset of original font file
So the goal I am trying to achieve is that when I click on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.