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 8487437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:14:22+00:00 2026-06-10T21:14:22+00:00

I am trying to set up an image that, when clicked, opens an iframe

  • 0

I am trying to set up an image that, when clicked, opens an iframe that gradually gets bigger, then closes onmouseout. Here is what I have so far:

<html>  
<head>
<link rel="stylesheet" href="Css/style.css" type="text/css" media="screen" />
<script language="JavaScript" type="text/javascript">
function makeFrame(src) {
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src","");
ifrm.setAttribute("onmouseout","closeFrame()")
ifrm.setAttribute("onclick","grow()")
ifrm.setAttribute("id","amazingIFrame")
ifrm.style.display = "block";
ifrm.style.width = 640+"px";
ifrm.style.height = 400+"px";
ifrm.style.marginLeft = "325";
ifrm.style.marginTop = "125";
ifrm.style.position = "absolute";
ifrm.style.top="0px";
ifrm.style.color="red";
ifrm.style.zIndex= "101";
document.body.appendChild(ifrm);
}
function closeFrame(){
ifrm.style.display = "none";
}
function grow() {
    ifrm = document.getElementById('amazingIFrame');
    if (ifrm.style.width < 500) {
        ifrm.style.width += 10;
    } else {
        clearInterval(interval);  // stop growing when it's big enough
    }
}
function startGrow() {
    interval = setInterval("grow()", 10);  // repeat every 10 ms
}
</script>

</head>
<body>
<img src="" onclick="makeFrame()" "height="100px" width="100px" />

</body>
</html>

This doesn’t work, though. Any ideas?

  • 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-10T21:14:24+00:00Added an answer on June 10, 2026 at 9:14 pm

    There are a couple issues.

    • you never call startGrow().
    • the iframe is already sized above 500px when you create it
    • ifrm.style.width < 500 is not right. ifrm.style.width will include the px, so you’ll be comparing 10px with 500…
    • the setInterval syntax is incorrect. Should be setInterval(grow, 10);
    • height has a double quote before it
    • you’re not passing any parameters, so src is going to be null (really just unnecessary).

    Try like this

    function makeFrame() {
    ifrm = document.createElement("IFRAME");
    ifrm.setAttribute("src","");
    ifrm.setAttribute("onmouseout","closeFrame()")
    ifrm.setAttribute("onclick","grow()")
    ifrm.setAttribute("id","amazingIFrame")
    ifrm.style.display = "block";
    ifrm.style.width = 0;
    ifrm.style.height = 400+"px";
    ifrm.style.marginLeft = "325";
    ifrm.style.marginTop = "125";
    ifrm.style.position = "absolute";
    ifrm.style.top="0px";
    ifrm.style.color="red";
    ifrm.style.zIndex= "101";
    document.body.appendChild(ifrm);
    startGrow();
    }
    function closeFrame(){
    ifrm.style.display = "none";
    }
    function grow() {
        ifrm = document.getElementById('amazingIFrame');
        var width = parseInt(ifrm.style.width.replace("px",""));
        if (width < 500) {
            ifrm.style.width = (width + 10) +"px";
        } else {
            clearInterval(interval);  // stop growing when it's big enough
        }
    }
    function startGrow() {
        interval = setInterval(grow, 10);  // repeat every 10 ms
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an image that I am attempting to load, and then reload. Here
I'm trying to grab the id of the image that is clicked and then
I am trying to resize an image that I have uploaded with a form.
I have a set of radio buttons that work when clicked where it will
I'm trying to set image for my UIBarButtonItem and I can't manage to do
I'm trying to set an image as a background image. From what I've read
I'm trying to set an image as background of the Sherlock Action Bar, but
I'm trying to set the image of a new view. I set the controller's
I'm trying to set an image as the background using this code: root.setStyle(-fx-background-image: url('splash.jpg');
I'm trying to set the image for the cell in a tableview by code.

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.