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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:03:12+00:00 2026-06-10T10:03:12+00:00

There is a simple HTML page, named say abc.html. Now abc.html has a button

  • 0

There is a simple HTML page, named say abc.html. Now abc.html has a button named say ‘click me’. This page, abc.html, also has an iframe, with an id say ‘myframe’.

Now what i want is that when the button, ‘click me’, is clicked an alert box should come up inside the iframe named ‘myframe’. How can i do this?

I have tried the following..

window.frames[0].contentWindow.alert("this is the iframe");

but this does not seem to work. Please let me knwo why does this not work and what could be an alternate solution.

  • 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-10T10:03:13+00:00Added an answer on June 10, 2026 at 10:03 am

    ContentWindow is derived from document, not window.

    What you will want to do is add the alert into a function on the iframe page, then use document.getElementById('targetFrame').contentWindow.targetFunction(); to call it, (using targetFunction as example). This answer may give you further information on techniques.

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

Sidebar

Related Questions

Is there a simple way to make an HTML page automatically adjust for mobile
The code segment is from a page called sites-catchup.html. There is a simple server
There has GOT to be a simple way to programmatically render HTML into a
I have a simple .html page which uses Javascript to display some popups. Now
A very simple question. I have a html page which is divided into three
Is there a simple way to reformat my HTML from within Komodo Edit or
Is there a simple way to upload a single file through HTML input type
I have the following task: there are a simple table from mysql database: <html>
I'm following this tutorial: http://developer.android.com/training/basics/firstapp/running-app.html#Emulator In it there is a simple code for a
I have created a simple html page to test the localstorage and for the

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.