Vbscript not working on Chrome or Firefox - only o

2019-02-23 03:18发布

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>

2条回答
爷的心禁止访问
2楼-- · 2019-02-23 03:26

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>
查看更多
劫难
3楼-- · 2019-02-23 03:41

VBScript only works in Internet Explorer

查看更多
登录 后发表回答