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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:41:09+00:00 2026-05-11T15:41:09+00:00

I was expreimenting to build a page editor. One issue just drove me crazy

  • 0

I was expreimenting to build a page editor. One issue just drove me crazy in firefox.

The page code is below:

<body> <iframe WIDTH=200 HEIGHT=200 id='myEditor'></iframe> <script>      function getIFrameDocument(sID){         // if contentDocument exists, W3C compliant (Mozilla)         if (document.getElementById(sID).contentDocument){             alert('mozilla'); // comment out this line and it doesn't work             return document.getElementById(sID).contentDocument;         } else {             // IE             alert('IE');             //return document.getElementById(sID);             return document.frames[sID].document;         }     }      getIFrameDocument('myEditor').designMode = 'On';  </script>  </body> 

It just check whether it is approprate to set ‘designMode’ in Mozilla way or IE way. When the page loads, a ‘Mozilla’ pops up; click the iframe area, and the focus is on the iframe and I can input with keyboard.

This looks fine, but when I comment out the line “alert(‘mozilla’);”, it doesnt work. The ‘designMode’ is ‘Off’ as FireBug shows.

This is so wired. Why a alert can affect the DOM and javascript? BTW, my Firefox is 3.0.6.

  • 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. 2026-05-11T15:41:09+00:00Added an answer on May 11, 2026 at 3:41 pm

    Because the alert gives the iframe time to load. You should set designMode to ‘on’ only after the iframe document has loaded:

    iframe.onload = function() {     doc.designMode = 'on'; }; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Item 2 of the Joel Test is Can you make a build in one
I'm just delving into Objective C and Cocoa Touch and I'm trying to build
I've just been experimenting with Jenkins and setting up a few projects. One inparticular
I am just starting to build an app that will display PDF documents. I've
I am experimenting with the build file that is part of a web deployment
I've started experimenting with Hudson as a build server. I'm using subversion and have
I'm experimenting with CSS Transitions these days. I'm trying to build an animated web
I'm experimenting with WeakReference, and I'm writing a code that checks if a weak
How can I build in wildcards to my LINQ To SQL lambda expression? This
I am trying to build a servlet that parses form input and creates a

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.