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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:08:43+00:00 2026-05-18T22:08:43+00:00

Expected : See 1-5 stars in Google Maps callout box Actual : Page blinks

  • 0

Expected: See 1-5 stars in Google Maps callout box
Actual: Page blinks and shows only a long list of stars on the top of the page.

I suspect I shouldn’t be using document.write?

<html>
    <head>

    <script type="text/javascript">

    //some Google Maps API code

         function showstar(x)
       {
        var i = 0;
        while (i < x)
        {
         document.write("<img src=\"img/star.gif\" width=\"15\" height=\"15\" />");
         i++;
        }
       }

       var html = "Review stars: " showstar(star)

       GEvent.addListener(marker, 'click', function() {
          marker.openInfoWindowHtml(html);
          });
          return marker;
        }

      </script>
    </head>

      <body onload="load()" onunload="GUnload()">
        <div id="map" style="width: 700px; height: 500px"></div>
      </body>

    </html>
  • 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-05-18T22:08:44+00:00Added an answer on May 18, 2026 at 10:08 pm

    Correct, you should not be using document.write like this – document.write Replaces All Body Content when executed before page load completed.

    Rather than document.write, return the HTML string at the end of the function:

    function showstar(x) {
        var i = 0, starsHTML = "";
        while (i < x) {
            starsHTML += "<img src=\"img/star.gif\" width=\"15\" height=\"15\" />";
            i++;
        }
        return starsHTML;
    }
    

    PS I’m assuming that star is defined and assigned a value somewhere before it is used, that you have not supplied in the code herein.

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

Sidebar

Related Questions

I have the following recursive code and it doesn't behave as expected (see details
I expected to see the word test appear in the output once and the
I recently ran git fsck --lost-found on my repository. I expected to see a
Expected Outcome: Successful installtion of Plone 4.1.4 Actual Outcome: Installation fails with: libxml2: cmmi
If I run this operation on List<Integer> for example, it works as expected (removes
I see a strange issue where the ScrollTo plugin scrolls twice the expected distance,
Expected output & output I get in debug mode, and release mode under VS2010,
I expected to find XMLStreamReader to be AutoCloseable in Java 7. However, that is
I expected these generators to be available: $ rails g Usage: rails generate GENERATOR
I expected this to print [b] but it prints [] : $x = abc;

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.