0

I have this basic page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Teste1.aspx.cs" Inherits="Testes.Teste1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title></title></head>
<body>
    <form id="form1" runat="server">
    <input id="clickMe" type="button" value="clickme" onclick="getText();" />
    </form>
<script type="text/vbscript" language="vbscript">
Function createText()
    createText = "A"
End Function
</script>
<script type="text/javascript"  language="javascript">
function getText(){
    var vbobj;
    vbobj = createText();
    alert("VBScript text = " + vbobj);
}
</script>
</body>
</html>

But this is not working, I'm getting the following message

Unhandled exception at line 27, column 5 in http://localhost:59632/Teste1.aspx 0x800a1391 - JavaScript runtime error: 'createText' is not defined

  • Possible duplicate of [Calling VBScript from Javascript](http://stackoverflow.com/questions/1039341/calling-vbscript-from-javascript) – user692942 Dec 28 '16 at 13:32

1 Answers1

0

I hope you know VBScript works only in IE. Try to put this meta tag in your head section:

<head>
    <meta http-equiv="x-ua-compatible" content="IE=10">
</head>

It helped me as I was using IE 11 edge mode, in which VBScript is no longer supported.

Enlico
  • 23,259
  • 6
  • 48
  • 102
Krzysztof Kaźmierczak
  • 1,401
  • 1
  • 11
  • 15