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

  • Home
  • SEARCH
  • 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 8364595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:27:51+00:00 2026-06-09T12:27:51+00:00

Wrote an exercise & solution page, with buttons that start js functions that show

  • 0

Wrote an exercise & solution page, with buttons that start js functions that show or hide the solutions. It works perfectly on up-to-date FF, CH and IE, but on IE8-7-6 when I click the buttons the solutions don’t show up and I get an “error on page” message in the status line.
I searched the web for a solution, tried ‘regsvr32 jscript.dll’, nothing helped.
here’s a jsFiddle, js doesn’t work there either but that’s probably because I don’t know how to use it properly. Anyway the code is there to view.

The problematic code is:
1. html buttons like this one:

<button class="button100" onclick="reveal('sol2');">הצג</button>

JS ‘reveal()’ function:

function reveal(pId){
        if(pId == 'all_sol'){
            for(var x in solArr){
                document.getElementById(x).innerHTML = "<button class=\"button100\" onclick=\"cover('" + x + "');\">הסתר</button>" + solArr[x];
            }
            document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"cover('" + pId + "');\">הסתר את כל הפתרונות</button>";
        }
        else {
            document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"cover('" + pId + "');\">הסתר</button>" + solArr[pId];
        }   
    }

and here is the hole thing:
the HTML:

<!DOCTYPE html>

<html>

    <head>
        <meta http-equiv="content-type" content="text/html;charset=iso-8859-8-i" />
        <link rel="stylesheet" type="text/css" href="general_style.css" />
        <link rel="stylesheet" type="text/css" href="exercises_style.css" />
        <script type="text/javascript" src="exercises_script.js"></script>
        <title> תרגילים </title>
    </head>

    <body>
        <div id="container">
            <div id="header">
                <div class="padding_10">
                    <img src="logo.png"></img>
                </div>
                <ul class="nav_bar">
                    <li><a href="operators.htm"> אופרטורים </a></li>
                    <li id="current_nav_bar_li"><a href="exercises.htm"> תרגילים </a></li>
                    <li><a href="concepts.htm"> מושגים </a></li>
                    <li><a href="template.htm">תבנית</a></li>
                </ul>
            </div>
            <div id="body">
                <div class="padding_10">

                    <h1> תרגילים ופתרונות </h1>
                    <p> להלן תרגילים שניתנו במהלך הקורס, בצירוף פתרונותיהם. בתרגילים חישוביים הפתרון מפרט כל פעולה חישובית ש JavaScript תבצע באם יוזן התרגיל לחישוב. השורה הראשונה מציגה את הביטוי המוזן לחישוב, כל שורה מכאן ואילך מציגה פעולה אחת של JavaScript. </p>

                    <h2> אלגוריתם ראשון </h2>
                    <h3> תרגיל 1 </h3>
                    <p>
                        הבת של טל יודעת:

                        <ol>
                            <li> לצייר ולכתוב </li>
                            <li> להוסיף 1 לכל מספר </li>
                            <li> להכפיל מספר בעצמו </li>
                            <li> לבדוק זהות בין שני מספרים </li>
                        </ol>

                        יש לכתוב אלגוריתם שבאמצעותו תוכל הבת של טל לחשב שורש ריבועי עבור מספר נתון.
                    </p>

                    <h3> פתרון תרגיל 1 </h3>
                    <p id="sol1">
                        <button class="button100" onclick="reveal('sol1');">הצג</button>
                    </p>


                    <h2> אופרטורים '+', '-', '*' </h2>
                    <h3> תרגיל 2 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            3 + 2 + 5 + 7 * 3 + 4 * 2 * 3
                        </div>
                    </p>

                    <h3> פתרון תרגיל 2 </h3>
                    <p id="sol2">
                        <button class="button100" onclick="reveal('sol2');">הצג</button>
                    </p>

                    <h3> תרגיל 3 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            5 - 2 * 4 * 3 - 7 - 9 - 4 - 2 - 1 * 3
                        </div>
                    </p>

                    <h3> פתרון תרגיל 3 </h3>
                    <p id="sol3">
                        <button class="button100" onclick="reveal('sol3');">הצג</button>
                    </p>

                    <h2> סוגריים </h2>
                    <h3> תרגיל 4 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            (2 + 3) + 5 + (4 + (2 * 2 + 5) - 2) + 3 * 3
                        </div>
                    </p>

                    <h3> פתרון תרגיל 4 </h3>
                    <p id="sol4">
                        <button class="button100" onclick="reveal('sol4');">הצג</button>
                    </p>

                    <h2> מודולו </h2>
                    <h3> תרגיל 5 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            5 % 2 % 5
                        </div>
                    </p>

                    <h3> פתרון תרגיל 5 </h3>
                    <p id="sol5">
                        <button class="button100" onclick="reveal('sol5');">הצג</button>
                    </p>

                    <h3> תרגיל 6 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            5 * 3 % 4 * 1 % 6
                        </div>
                    </p>

                    <h3> פתרון תרגיל 6 </h3>
                    <p id="sol6">
                        <button class="button100" onclick="reveal('sol6');">הצג</button>
                    </p>

                    <h2> שמות משתנים </h2>
                    <h3> תרגיל 7 </h3>
                    <p>
                        האם שמות המשתנים להלן חוקיים?
                        <div dir="ltr">
                            <ol class="margin_left">
                                <li> --- </li>
                                <li> ______ </li>
                                <li> 0_ </li>
                                <li> a_a </li>
                                <li> a1321 </li>
                                <li> ab 12 </li>
                                <li> var </li>
                            </ol>
                        </div>
                    </p>

                    <h3> פתרון תרגיל 7 </h3>
                    <p id="sol7">
                        <button class="button100" onclick="reveal('sol7');">הצג</button>
                    </p>

                    <h2> השמה </h2>
                    <h3> תרגיל 8 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            var x, y, z;<br />
                            z = x = 2 * 2 + 3 + ( 4 + 5 ) + ( x = 3 ) * ( y = 2 )
                        </div>
                    </p>

                    <h3> פתרון תרגיל 8 </h3>
                    <p id="sol8">
                        <button class="button100" onclick="reveal('sol8');">הצג</button>
                    </p>

                    <h3> תרגיל 9 </h3>
                    <p>
                        פתור את התרגיל על פי סדר הקדימות ב- JavaScript:
                        <div dir="ltr">
                            var x, y, z;<br />
                            x = ( x = y = z = ( 2 * 5 ) + 3 + 2 % 2 ) % ( z = 2 - 1 * 3 )
                        </div>
                    </p>

                    <h3> פתרון תרגיל 9 </h3>
                    <p id="sol9">
                        <button class="button100" onclick="reveal('sol9');">הצג</button>
                    </p>

                    <p id="all_sol">
                        <button class="button100" onclick="reveal('all_sol');">הצג את כל הפתרונות</button>
                    </p>
                </div>
            </div>
            <div id="footer">
                <ul>
                    <li> כל הזכויות על החומר הלימודי באתר שמורות לטל שחור </li>
                    <li> האתר נבנה על ידי יחזקאל יובל </li>
                    <li> 050-9035454 </li>
                    <li> yovel.zack@gmail.com </li>
                </ul>
            </div>
        </div>
    </body>

</html>

and JS:

var solArr = new Object();

solArr.sol1 = "<ol><li> אם המספר הוא 0 או 1, הוא גם השורש של עצמו. אמרי לאבא שהמספר הוא השורש. אחרת המשיכי לשלב הבא.</li><li> ציירי שלושה ריבועים. </li><li> באמצעי רשמי את המספר שאת השורש שלו צריך לחשב. </li><li> בשמאלי רשמי את המספר 2.</li><li> בימני רשמי את התוצאה של הכפלת המספר הרשום בריבוע השמאלי בעצמו. </li><li> בדקי אם המספר הרשום בריבוע הימני זהה למספר הרשום בריבוע האמצעי. </li><li> אם יש זהות, אמרי לאבא שהמספר הרשום בריבוע השמאלי הוא השורש. אחרת המשיכי לשלב הבא. </li><li> אם אין זהות,  הוסיפי למספר הרשום בריבוע השמאלי 1 וחיזרי לשלב 5.</li></ol>";

solArr.sol2 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>3 + 2 + 5 + 7 * 3 + 4 * 2 * 3</li><li>3 + 2 + 5 + 21 + 4 * 2 * 3</li><li>3 + 2 + 5 + 21 + 8 * 3</li><li>3 + 2 + 5 + 21 + 24</li><li>5 + 5 + 21 + 24</li><li>10 + 21 + 24</li><li>31 + 24</li><li>55</li></ol></div>";

solArr.sol3 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>5 - 2 * 4 * 3 - 7 - 9 - 4 - 2 - 1 * 3</li><li>5 - 8 * 3 - 7 - 9 - 4 - 2 - 1 * 3</li><li>5 - 24 - 7 - 9 - 4 - 2 - 1 * 3</li><li>5 - 24 - 7 - 9 - 4 - 2 - 3</li><li>-19 - 7 - 9 - 4 - 2 - 3</li><li>-26 - 9 - 4 - 2 - 3</li><li>-35 - 4 - 2 - 3</li><li>-39 - 2 - 3</li><li>-41 - 3</li><li>-44</li></ol></div>";

solArr.sol4 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>(2 + 3) + 5 + (4 + (2 * 2 + 5) - 2) + 3 * 3</li><li>() + 5 + () + 3 * 3</li><li>() + 5 + () + 9</li><ol class=\"margin_left\"><li>2 +3</li><li>5</li></ol><li>5 + 5 + () + 9</li><li>10 + () + 9</li><ol class=\"margin_left\"><li>4 + () - 2</li><ol class=\"margin_left\"><li>2 * 2 + 5</li><li>4 + 5</li><li>9</li></ol><li>4 + 9 - 2</li> <li>13 - 2</li> <li>11</li></ol><li>10 + 11 + 9</li><li>21 + 9</li><li>30</li></ol></div>";

solArr.sol5 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>5 % 2 % 5</li><li>1 % 5</li><li>1</li></ol></div>";

solArr.sol6 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>5 * 3 % 4 * 1 % 6</li><li>15 % 4 * 1 % 6</li><li>3 * 1 % 6</li><li>3 % 6</li><li>3</li></ol></div>";

solArr.sol7 = "<div dir=\"ltr\"><table><tr><td> --- </td><td> לא חוקי </td></tr><tr><td> ______ </td><td> חוקי </td></tr><tr><td> 0_ </td><td> לא חוקי </td></tr><tr><td> a_a </td><td> חוקי </td></tr><tr><td> a1321 </td><td> חוקי </td></tr><tr><td> ab 12 </td><td> לא חוקי </td></tr><tr><td> var </td><td> לא חוקי </td></tr></table></div>";

solArr.sol8 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>var x, y, z</li><li>z = x = 2 * 2 + 3 + ( 4 + 5 ) + ( x = 3 ) * ( y = 2 )</li><li>z = x = 2 * 2 + 3 + () + () * ()</li><li>z = x = 4 + 3 + () + () * ()</li><ol><li>x = 3</li><li>3//x == 3</li></ol><ol><li>y = 2</li><li>2//y == 2</li></ol><li>z = x = 4 + 3 + () + 3 * 2</li><li>z = x = 4 + 3 + () + 5</li><li>z = x = 7 + () + 5</li><ol><li>4 + 5</li><li>9</li></ol><li>z = x = 7 + 9 + 5</li><li>z = x = 16 + 5</li><li>z = x = 21</li><li>z = 21//x == 21</li><li>21//z == 21</li></ol></div>";

solArr.sol9 = "<div dir=\"ltr\"><ol class=\"margin_left\"><li>x = ( x = y = z = ( 2 * 5 ) + 3 + 2 % 2 ) % ( z = 2 - 1 * 3 )</li><li>x = () % ()</li><ol><li>x = y = z = () + 3 + 2 % 2</li><li>x = y = z = () + 3 + 0</li><li>x = y = z = () + 3</li><ol><li>2 * 5</li><li>10</li></ol><li>x = y = z = 10 + 3</li><li>x = y = z = 13</li><li>x = y = 13 //z == 13</li><li>x = 13 //y == 13</li><li>13 //x == 13</li></ol><li>x = 13 % ()</li><ol><li>z = 2 - 1 * 3</li><li>z = 2 - 3</li><li>z = -1</li><li>-1 //z == -1</li></ol><li>x = 13 % -1</li><li>x = 0</li><li>0 //x == 0</li></ol></div>";

function reveal(pId){
    if(pId == 'all_sol'){
        for(var x in solArr){
            document.getElementById(x).innerHTML = "<button class=\"button100\" onclick=\"cover('" + x + "');\">הסתר</button>" + solArr[x];
        }
        document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"cover('" + pId + "');\">הסתר את כל הפתרונות</button>";
    }
    else {
        document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"cover('" + pId + "');\">הסתר</button>" + solArr[pId];
    }   
}


function cover(pId){
    if(pId == "all_sol"){
        for(var x in solArr){
            document.getElementById(x).innerHTML = "<button class=\"button100\" onclick=\"reveal('" + x + "');\">הצג</button>";
        }
        document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"reveal('" + pId + "');\">הצג את כל הפתרונות</button>";
    }
    else{
        document.getElementById(pId).innerHTML = "<button class=\"button100\" onclick=\"reveal('" + pId + "');\">הצג</button>";
    }
}
  • 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-09T12:27:52+00:00Added an answer on June 9, 2026 at 12:27 pm

    uhh, a lot of things don’t work on IE6 or 7. I suggest you drop support for them. Even Microsoft doesn’t support it anymore! However, if you really need to go ahead with this, then use jQuery, which should fix your problems (when used correctly)

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

Sidebar

Related Questions

I'm solving this K&R exercise: Write versions of the library functions strncpy , strncat
As an exercise I wrote a short Haskell function that returns the first four
I direct you to Kernighan & Ritchie exercise 7.1 Write a program that converts
I'm doing an exercise in K&R: Write a program detab that replaces tabs in
I'm writing an exercise in C++, and I wrote a code that seems to
I wrote an in-place permutation algorithm [an exercise in TAOCP3], where the inner loop
The Problem: Exercise 2-8 of The C Programming Language, Write a function rightrot(x,n) that
I'm pretty new to lockless data structures, so for an exercise I wrote (What
I'm writing code for the exercise 1-24, K&R2, which asks to write a basic
I'm going through K & R, and am having difficulty with incrementing pointers. Exercise

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.