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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:03:46+00:00 2026-05-26T11:03:46+00:00

So eventually I want to have a greasemonkey script but for now I have

  • 0

So eventually I want to have a greasemonkey script but for now I have only been working with firebug to test out my html/javascript.

I have this code to insert one button in the HTML toolbar for blogger.
The button is supposed to replace all the   with ” ” as blogger seems to just randomly add   into my blogs posts and can cause the published article to look weird (a bunch of words separated in between with  s will not want to break in the middle unlike the same words separated with ” “).

 document.getElementById("postingHtmlToolbar").firstChild.innerHTML += '<div id="SP" class="goog-inline-block goog-toolbar-button" title="SP" role="button" style="-moz-user-select: none;"><div class="goog-inline-block goog-toolbar-button-outer-box"><div class="goog-inline-block goog-toolbar-button-inner-box"><a href="javascript:document.getElementById(\'postingHtmlBox\').value = document.getElementById(\'postingHtmlBox\').value.replace(/&nbsp;/g, \' \');"><b>SP</b></a></div></div></div>';

Which trimming away the formatting just leaves us with.

  <a href="javascript:document.getElementById('postingHtmlBox').value = document.getElementById('postingHtmlBox').value.replace(/&nbsp;/g, ' ');"><b>SP</b></a>

The funny thing is that that same code (minus the href, javascript: stuff) run from firebug works perfectly.

But when it is inserted like this and run it blanks the entire web page and writes the value of document.getElementById('postingHtmlBox').value.replace(/&nbsp;/g, ' ') into this black page.

Am I forgetting something stupid? Is this supposed to happen? Do I have some stupid syntax error? What would you suggest as a 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-05-26T11:03:46+00:00Added an answer on May 26, 2026 at 11:03 am

    Don’t put JS code in href. use onclick:

    <a href="javascript//" onclick="document.getElementById('postingHtmlBox').value = document.getElementById('postingHtmlBox').value.replace(/&nbsp;/g, ' ');"><b>SP</b></a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we've got an existing webapplication written in magic. But now we eventually want to
say I want to scaffold generate university but university should eventually be related to
The .NET garbage collector will eventually free up memory, but what if you want
I'd like to eventually publish one of the iPhone projects I've been working on
So this question will get technical – eventually – but first check out Hanselminutes
I have the following versions installed: thin (1.2.11, 1.2.7, 1.2.2) But I always want
I am trying to represent weighted edges. I eventually want to have OutE to
OK this is really bugging me now. Eventually I want to add some ifs
I have a function that I eventually want to parallelize. Currently, I call things
I have a question I really want answered. I have been playing around with

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.