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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:21:32+00:00 2026-06-19T00:21:32+00:00

Edit I originally phrased this question as if browser detection was causing my problem,

  • 0

Edit

I originally phrased this question as if browser detection was causing my problem, but it was simply caused by incorrect syntax.

  1. Make sure to close all brackets (they should always come in pairs!)
  2. Give your code some space (it will be easier to spot mistakes!)
  3. Clean up your if-statements by moving messy conditional expressions into variables
  4. Use semantic (ideally unambiguous) variable names — this makes it easier to understand what your code is trying to do

For example, the following:

const layoutStyles = document.querySelector('#layoutStyles');
const testElement = document.createElement('div');

let supportsFlex = testElement.style.flex !== undefined;
let supportsFlexFlow = testElement.style.flexFlow !== undefined;

if (supportsFlex && supportsFlexFlow) {

  layoutStyles.setAttribute('href', 'flex-layout.css');

} else {

  layoutStyles.setAttribute('href', 'float-layout.css');
}

is technically equivalent to this:

const cond = document.querySelector('#cond');
const tstEl = document.createElement('div');
if (tstEl.style.flex!==undefined&&tstEl.style.flexFlow!==undefined)cond.setAttribute('href','flex-layout.css');
else cond.setAttribute('href','float-layout.css');

but the latter is much harder to read and understand. Thus it is also harder to debug and refactor, and easier to accidentally introduce errors.

As the contributors wrote in their answers long ago, it’s important to learn language basics; crawl before you walk, walk before you run!


For some reason, this portion of javascript is blocking out all the other functions I have written previously. They work if I take it out, and stop working when I put it back in.

If someone can spot what’s wrong, please let me know! I’m not very good with JS really, so I’m not quite 100% sure what I’m even doing here.

Well, I used this as my reference; http://www.javascriptkit.com/javatutors/navigator.shtml

Here’s my code:

//4th batch shows a warning box upon finding a visitor with an outdated browser
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
 var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Opera/x.x or Opera x.x (ignoring remaining decimal places);
 var oprversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 
if (ffversion<11 || ieversion<9 || oprversion<11.6)
 function browserwarning()
 {
 document.getElementById('oldbrowser').style.display="inherit";
 }
 //END OF 4TH BATCH
  • 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-19T00:21:33+00:00Added an answer on June 19, 2026 at 12:21 am

    You forgot some closing brackets and function inside if-statesment are invalid. This code will work without syntax errors:

    //4th batch shows a warning box upon finding a visitor with an outdated browser
    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
        var ffversion = new Number(RegExp.$1); // capture x.x portion and store as a number
    } else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
        var ieversion = new Number(RegExp.$1); // capture x.x portion and store as a number
    } else if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { //test for Opera/x.x or Opera x.x (ignoring remaining decimal places);
        var oprversion = new Number(RegExp.$1); // capture x.x portion and store as a number
    }
    
    if (ffversion < 11 || ieversion < 9 || oprversion < 11.6) {
        document.getElementById('oldbrowser').style.display = "inherit";
    }
    

    But I highly recommend you to to some efforts in learning how to use and write javascript code. It looks like you are trying to write a letter in chinese although you don’t even know their symbols…

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

Sidebar

Related Questions

EDIT: This question was originally about checkboxes, but I am getting the same behavior
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
EDIT: Originally this question asked how I could authenticate with the Google Analytics API
EDIT: This question title originally was: How does Doctrine know last inserted id in
EDIT : Since the original wording of my question caused much frowning I re-phrased
Edit: original question below, but I revise it now that I have some code
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: My question was originally Is there a standard name for a function that
(function() { //do stuff })(); EDIT: I originally thought this construct was called a
EDIT: This question is invalid. Turns out a transparent proxy was making an onward

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.