www.webdeveloper.com
Results 1 to 4 of 4

Thread: FF works great, MSIE: nfg, any reason why?

  1. #1
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,373

    Question FF works great, MSIE: nfg, any reason why?

    First off, the attached code is not for any project due for class or anything else.

    That being said, I have found a number of 'neat' functions,
    mostly recommended by other forum members,
    that I usually cannot relocate when I want to use them.
    ("CRS" problem that occurs with maturity).

    I wanted to put them into one site that I would be able to remember
    with the ability to copy and paste the function into other projects.

    I created a tab display that works very well in FF on PC and iMac.

    However, after a certain point, the display in MSIE gets lost.
    I have tried putting in selective alerts to isolate the problem,
    but I don't seem to be able to put them where they do any good for me.

    To see the problem, select some of the later tabs or try running some of the examples
    from some of the buttons within the tab display in both MSIE and FF.

    Can any one see an obvious mistake that allows all to work well in FF, but becomes buggy in MSIE?

    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    First thing I have noticed is that your document has no Doctype.

    http://www.w3schools.com/tags/tag_DOCTYPE.asp

    Without a certain DTD, browsers' interpretors work in so called "quirks mode" (in opposition to the "strict mode"), which may provoke weird interpretation of CSS and javascript codes.

  3. #3
    Join Date
    Oct 2008
    Location
    U.S.
    Posts
    726
    It is strange, if you alert the elements in the choose function, TEXT8 onwards are null for the div element. If you comment out the script that is in the TEXT7 div it works fine. For some reason it is having trouble with the document.write of the English.toString(). I found that if I change that to replace < or > it works fine then.
    Change TEXT7 div to the following:
    HTML Code:
     <div id="TEXT7" class="TEXT"> 
      <p>     
         7. Represent a small bilingual lexicon as a Javascript object in the following fashion <br>
            {"merry":"god", "christmas":"jul", "and":"och", 
             "happy":gott", "new":"nytt", "year":"&#229;r"} <br>
            and use it to translate your Christmas cards from English into Swedish.<br>
        <input type="button" onclick="Solution7()" value='Run Solution'>
        <input type="button"
         onclick="document.getElementById('Solutions').innerHTML=Solution7.toString()" 
         value='View Solution'>
        <input type="button" onclick="FunctionDisplays(English)" value='View Functions'>
    <pre>
    var lexicon = {"merry":"god", "christmas":"jul", "and":"och", 
                   "happy":gott", "new":"nytt", "year":"&#229;r"};
    var spanish = {"merry":"feliz", "christmas":"navidad", "and":"y", 
                   "happy":"feliz", "new":"nueve", "year":"anos"};
    <script type="text/javascript">var str = English.toString(); document.write(str.replace(/</g,'&lt;').replace(/>/g,'&gt;'));</script>
    </pre>
     </div>
    Note the changes within the script only. If you look at all your other document.write's that write out functions that contain those characters < > you will find you will want to do same to them, as they are all stopping at the first < character, typically in loop definitions. So you might want to make a function such as:
    function preDW(str) {
    document.write(str.replace( .... etc etc you get the picture, then use in place of your document.write's within the pre tags
    edit: actually, just the '<' characters seem to need to be replaced
    Last edited by astupidname; 06-25-2009 at 02:06 AM.

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,373
    Thank you both.

    I'll give each change an attempt and report back about success.

    Appreciate the looks and comments.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles