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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:22:09+00:00 2026-06-01T14:22:09+00:00

In other words what’s the difference between onclick=myFunction() and onclick=JavaScript:myFunction()

  • 0

In other words what’s the difference between

onclick="myFunction()"

and

onclick="JavaScript:myFunction()"
  • 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-01T14:22:11+00:00Added an answer on June 1, 2026 at 2:22 pm

    The JavaScript: TYPE/LABEL/PREFIX (could not find the actual name for it) in the event handler serves one purpose only:

    In Internet Explorer (which supported VBScript as a browser language),
    IFF the FIRST script on the page is NOT JavaScript, inline JavaScript on the rest of the page had to have javascript: prefixing it.

    It is not to be confused with the javascript: protocol in the href (which, by the way, also should be avoided). href="javascript:..." is only ever needed in old netscapes in the AREA tag. When you see the href="javascript:void(0)" someone needs to use onclick="....; return false" instead, unless they put it there to alert the user that the link is a javascript driven one. It will fail if JS is turned off.

    Even better is to remove inline event handlers and use addEventListener – delegate when more than one element that needs the same eventListener.

    I looked for the official documentation from msdn, but here are discussions to back me up:

    Calling VBScript from Javascript

    Internet Explorer defaults to the language of the first script element
    it parses. So if the first script element is javascript, you shouldn’t
    need to specify "javascript:" in your event handler.

    https://www.webdeveloper.com/forum/archive/index.php/t-135462.html (link not working anymore)

    You have to tell IE you are using VBS AND JScript, otherwise the
    assumption is all functions are VBS in this instance. Either add a
    (empty?) JavaScript script element [at the top of your page] or use the jscript: protocol on the
    onchange.
    onchange="jscript:location.hash=this[this.selectedIndex].value;"

    Example

    <html>
    <head>
    <script language="VBScript">
    ' some vbscript here forces the default language
    ' of the page to be VBScript and not jScript/JavaScript
    </script>
    </head>
    <body onload="javascript:alert('I am inline in an event handler - boo me')">
    .
    .
      <a href="..." onclick="javascript:alert('and so am I'); return false">Click</a>
    .
      <a href="javascript:alert('The javascript: PROTOCOL is NOT the same')">Click</a>
    
    
    </body>
    </html> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In other words, what's the difference between the mkvirtualenv and mkproject commands? I have
In Spring Security What's difference between ROLE_ANONYMOUS and IS_AUTHENTICATED_ANONYMOUSLY . In other words ,
In other words, I want to do a regular, non-AJAX request, but using Javascript.
Or in other words What are the main difference in type arguments inference for
In other words, does the following make a difference: this: using a; using b;
In other words, given a base class shape and a derived class rectangle :
In other words, I have a string like: anything, escaped double-quotes: \, yep anything
In other words, can I do something with a volatile variable that could not
In other words, if I fill two unordered_map , or unordered_set , objects with
In other words, is there a way to rewind it to the beginning? EDIT

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.