Vb脚本不适用于Chrome或Firefox - 仅适用于Internet Explorer [英] Vb script not working on Chrome or Firefox - only on Internet Explorer
问题描述
< SCRIPT LANGUAGE =VBScript>
Sub clickHandler()
sP = Window.Event.SrcElement.ID
如果Left(sP,1)=M则
Set oC = Document.All(C & Mid(sP,2))
如果oC.Style.Display =none则
oC.Style.Display =
否则
oC.Style。 Display =none
End If
Set oC = Nothing
End If
End Sub
< / SCRIPT>
客户端VBScript代码 em>适用于IE浏览器。
Chrome和Firefox,更符合标准,期望Javascript客户端代码
它看起来像你的点击处理程序隐藏/显示的东西。这在使用JQuery的Javascript中是很容易实现的,例如,当它被点击时,它应该隐藏'elementid':
$ p $ < script src =// code.jquery.com/jquery-1.11.0.min.js\"></script>
< script>
$(document).ready(function(){
$('#elementid')。click(function(){
$(this).hide();
});
});
< / script>
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>
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>
这篇关于Vb脚本不适用于Chrome或Firefox - 仅适用于Internet Explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!