最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Calling VBScript from Javascript - Stack Overflow

programmeradmin2浏览0评论

I've seen the related post on this, but it only covers using inline VBScript for onmouseover events, while calling a Javascript Function for the onClick.

Is there a way to call a VBScript Sub for the onClick event from a button that uses Javascript onmouseover and onmouseout events?

Currently when I try I get an error that the object does not support the property or method.

I've seen the related post on this, but it only covers using inline VBScript for onmouseover events, while calling a Javascript Function for the onClick.

Is there a way to call a VBScript Sub for the onClick event from a button that uses Javascript onmouseover and onmouseout events?

Currently when I try I get an error that the object does not support the property or method.

Share Improve this question edited Jun 24, 2009 at 16:15 stefanB 80k28 gold badges119 silver badges143 bronze badges asked Jun 24, 2009 at 16:06 MattWMattW
Add a ment  | 

3 Answers 3

Reset to default 2

It is possible, but you will need to prefix all your script calls in HTML with the appropriate language.

onmouseover="javascript: vbfunction();"

If there are script calls that are not prefixed, you may get errors on the page as the parser doesn't know what scripting language is being used.

Put your code in the Head Tags: <head> </head>

Add your VBScript between these brackets:

<script type="text/vbscript">
</script>

Function myVBFunction()
    ' here es your vbscript code
End Function

// From a hardcoded link, don't write a semicolon a the end:
<a href="#" onclick="VBscript:myVBFunction('parameter')">link</a> 

You can read more about it here.

Make sure that the name of the sub you're calling doesn't match the ID of any other object in the script.

发布评论

评论列表(0)

  1. 暂无评论