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

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.