13446

Start/Stop methods for embeded Windows Media Player via VBScript

Question:

I have following code working fine.

<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer" width="242" height="202" style="position:absolute; left:1;top:1;"> <param name="URL" value="C:\HTML\Sounds\oos.wav"> <param name="autoStart" value="0"> </object>

I would like to crearte <strong>Start/Stop</strong> methods in VBScript for this object.

So I am doing like

Sub Start Dim oElm Set oElm = document.getElementById("WindowsMediaPlayer") if oElm Is Nothing then MsgBox("element does not exist") else ' MsgBox("element exists") oElm.controls.play(); end if End sub

But it does not work.

How to fix it?

Answer1:

It shoul dbe done like this

<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer" width="0" height="0"> </object> Sub Start Dim oElm Set oElm = document.getElementById("WindowsMediaPlayer") if oElm Is Nothing then MsgBox("element does not exist") else oElm.controls.stop() oElm.URL = "C:\HTML\Sounds\oos.wav" end if End sub

Recommend

  • jParallax trouble
  • Symfony2 redirect to https route fails (uses wrong port)
  • PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea
  • Use default value of a column in stored procedures
  • Making header act like google chrome mobile app address bar
  • conditions for accessors in Coldfusion ORM
  • Enumerating Controls on a Form
  • Passing “get” parameters doesn't work, parameter not visible in the link
  • Basic many-to-many left join query
  • Why isn't obj.style.left = “200px”; working in this code?
  • Javascript, Regex - I need to grab each section of a string contained in brackets
  • Floated image with variable width and heading with background image
  • Remove final comma from string in vb.net
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • Declaring variable dynamically in VB.net
  • Blackberry - Custom EditField Cursor
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • How do I alternate colors in Flat List (React Native)
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Disable Enter in editText android
  • Body moving without any force applied? (Box2d)
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • How to set/get protobuf's extension field in Go?
  • Submit form in a displaytag pagination
  • How to check if every primary key value is being referenced as foreign key in another table
  • How to show dropdown in excel using jrxml (jasper api)?
  • jquery mobile loadPage not working
  • Unanticipated behavior
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Load html files in TinyMce
  • python regex in pyparsing
  • How to set the response of a form post action to a iframe source?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Change div Background jquery
  • Android Google Maps API OnLocationChanged only called once
  • python draw pie shapes with colour filled
  • JaxB to read class hierarchy