Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vb script not working on Chrome or Firefox - only on Internet Explorer

I wrote VBScript in my project, but this is only working on IE and not chrome/firefox. I need a VBScript library for my code. How will this code work on chrome and firefox. My code is

<SCRIPT LANGUAGE="VBScript">
     Sub clickHandler()
         sP = Window.Event.SrcElement.ID
         If Left(sP, 1) = "M" Then
             Set oC = Document.All("C" & Mid(sP, 2))
             If oC.Style.Display = "none" Then
                 oC.Style.Display = ""
             Else
                 oC.Style.Display = "none"
             End If
             Set oC = Nothing
         End If
     End Sub
</SCRIPT>
like image 842
user3623126 Avatar asked May 13 '14 06:05

user3623126


People also ask

Is VBScript supported in Chrome?

VBScript is supported just by Microsoft's Internet Explorer while other browsers (Firefox and Chrome) support just JavaScript.

Why VBScript is not working?

Right-click the VBS file that you cannot run and click "Properties." Click the "Change" button and double-click "Microsoft Windows Based Script Host" to restore the association. If you cannot find this item, click "Browse" and go to the "System32" folder inside your "Windows" folder in your primary drive.

Does IE 11 support VBScript?

Only IE 10 and older supports VBScript.


2 Answers

Client-side VBScript code only works on IE.

Chrome and Firefox, being more standards compliant, expect Javascript client-side code

It looks like your click handler is hiding/displaying something. This is quite easily achievable in Javascript with JQuery, eg this should hide 'elementid' when it is clicked:

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){
  $('#elementid').click(function(){
    $(this).hide();
  });
});
</script>
like image 105
Jobbo Avatar answered Sep 19 '22 00:09

Jobbo


VBScript only works in Internet Explorer

like image 21
Jonco98 Avatar answered Sep 21 '22 00:09

Jonco98