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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:20:13+00:00 2026-05-27T10:20:13+00:00

I have some javascript in a div to make it move from an iframe

  • 0

I have some javascript in a div to make it move from an iframe to the main page. It works fine but when I use & like this:

function JS_onMouseOverBG(e, i_bg) {
  if( (block == 0)&&(i_bg != selected) ) {
    e.style.cursor = 'pointer' ;
  } else {
    e.style.cursor = '' ;
  }
}

Then & becomes & and I have this firefox error:

Erreur : missing ) after condition
Fichier Source : http://192.168.0.20/lb/?p=467&w=prefs_bggen
Ligne : 905, Colonne : 22
Code Source :
  if( (block == 0)&&(i_bg != selected) ) { 

I tried using the unicode \u0026 of & but it does not work. I have an error of illegal character.

How can I do to use & in such a case ?

Edit:
I’ve found the solution, if someone looks for the same issue:

function JS_decode(str) {
  var div = document.createElement('div'); 
  div.innerHTML = str ;
  var decoded = div.firstChild.nodeValue; 
  return decoded ;
}

And I use this function for this DIV DIV_cover_js containing the Javascript code:

var eleJS = document.createElement("script") ;
eleJS.type = 'text/javascript' ;
eleJS.text = get('DIV_cover_js').innerHTML ;
eleJS.text = JS_decode(WP.eleJS.text) ;
eval(eleJS.text);
  • 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-27T10:20:14+00:00Added an answer on May 27, 2026 at 10:20 am

    (Quoted from a comment by the OP):

    WP.eleJS.text = get('DIV_prefs_js').innerHTML ; eval(WP.eleJS.text);

    If the original HTML includes && then that is an error and the browser is correcting it.

    You then get a serialisation of the DOM to HTML and try to treat some HTML as JavaScript.

    If you really want to do this, then you should extract a textNode and use its data instead of innerHTML, however the approach is ugly, slow and hard to debug. You should have a proper JS function loaded via a <script> element in the first place.

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

Sidebar

Related Questions

i have some javascript roll over code that works fine in firefox but when
I have some one page whose div elements are aligned by JavaScript. The JavaScript
I have some JavaScript code that works in IE containing the following: myElement.innerText =
I have a php page and i have some javascript code to have a
I have a page that contains an iframe that gets loaded using Javascript: index.html
I have some markup for a popup menu that works in firefox but not
I have some javascript to set the offsetLeft attribute of an img element. But
I'm using javascript to move a div down the page as you scroll. I
I have some javascript which will create some sort of widget on a page.
I have some javascript that I'm trying to retool using jQuery to learn the

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.