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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:04:42+00:00 2026-06-10T05:04:42+00:00

document.getElementById(but).onclick = function(e) { showDropDown(this, e); }; function showDropDown(element, e) { element.onclick = function()

  • 0
document.getElementById("but").onclick = function(e) {
showDropDown(this, e);
};

function showDropDown(element, e) {
element.onclick = function() {};
if (e.stopPropagation) e.stopPropagation(); // W3C model
else e.cancelBubble = true; // IE model
document.getElementById("window").style.display = "inline-block";
document.onclick = function(e) {
    var ele = document.elementFromPoint(e.clientX, e.clientY);
    if (ele == element) {
        hideDropDown();
        return;
    }
    do {
        if (ele == document.getElementById("window")) return;
    } while (ele = ele.parentNode);
    hideDropDown(element);
};
}

function hideDropDown(element) {
document.onclick = function() {};
document.getElementById("window").style.display = "none";
element.onclick = function(e) {
    showDropDown(this, e);
};
}​


   <input id="but" type="button" value="pressMe" />
   <div id="window" style="display:none">popup</div>​

errors: https://www.dropbox.com/s/uzeiq6043rvueqf/Capture.PNG https://www.dropbox.com/s/w3rct18cumwva7m/bar3.png

  • 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-10T05:04:43+00:00Added an answer on June 10, 2026 at 5:04 am

    What you did was where you copied or wrote this code, there most likely was a bug in it. JSFiddle has been known to have such problems. What you have to do is type that section of code (1 line above the error and 1 line underneath it) in a simple editor such as Notepad or TextEdit, and then copy that over and replace your current code. I know its this error, as the Unexoected token ILLEGAL part of it meant that the hidden character which is placed there is obviously not JavaScript-compliant, therefore it is not a syntax error at all.

    Works for me.

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

Sidebar

Related Questions

document.getElementById(but).onclick = showDropDown; function showDropDown(e) { document.getElementById(but).onclick = function() {}; if (e.stopPropagation) e.stopPropagation(); //
I've got JavaScript code like this => (function(){ document.getElementById(element).onclick = function(){ var r =
So for example I can do this: document.getElementById('element').onclick = function() { document.getElementById('element').style.color = '#FFFFFF';
I have a js code: window.onload = function() { document.getElementById(Button1).onclick = function() { var
I have this code: document.getElementById('img'+i).onclick = function(){popup_show('popup',array_msg[i]+'|||'+date('Y-m-d',strtotime(lec_date))+'-==-'+str_view_forConflict, 'AddEditSchedule;;popup_drag2;;EditSched;;'+String(array_msg_id[3])+';;view', 'popup_drag', 'popup_exit', 'screen-center', 0, 0);}; ...but
I have the javascript code for a link click: document.getElementById('giddy').onclick = function { alert(this.href);
This works : alert(document.getElementById(Container).nodeName); But this doesnt : var CurParent = document.getElementById(Container); alert(CurParent.nodeName); I
A regular dom element is such as: document.getElementById('a') or document.createElement('div') But jQuery returns elements
Is there a reason why I can do this: document.getElementById('gridID').style.background='blue'; but when I try
This is my script : window.onload = function (){ var title = document.getElementsByTagName('h1')[0].id =

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.