u jayakodi
-
Total Posts
:
17
- Scores: 0
-
Reward points
:
0
- Joined: 9/30/2010
-
Status: offline
|
CALL JavaScript in VBScript
Friday, January 07, 2011 12:05 AM
( permalink)
jayakodiu@yahoo.com CALL JavaScript in VBScript JS has Maths, Array, Date & String as objects having several useful functions not available directly in VBS; a method of creating these objects and using their functions in VBS is shown in the snippet below: <html> <body> </body> <script language=vbs> set ele=document.body.appendChild(document.createElement("script")) ele.setAttribute "language","javascript" ele.text="var vbm,vbar;vbm=Math;vbar=new Array()" 'use atan2 of js msgbox vbm.atan2(1,1)*180/vbm.pi 'create an array and use vbar.push 42,44,43,45,46,47 msgbox vbar.length msgbox vbar.toString() msgbox vbar.valueOf() msgbox "reversed "+vbar.reverse() msgbox "sorted " +vbar.sort() </script> </html> JS has Maths, Array, Date & String as objects having several useful functions not available directly in VBS; a method of creating these objects and using their functions in VBS is shown in the snippet below: <html> <body></body> <script language=vbs> set ele=document.body.appendChild(document.createElement("script")) ele.setAttribute "language","javascript" ele.text="var vbm,vbar;vbm=Math;vbar=new Array()" 'use atan2 of js msgbox vbm.atan2(1,1)*180/vbm.pi 'create an array and use vbar.push 42,44,43,45,46,47 msgbox vbar.length msgbox vbar.toString() msgbox vbar.valueOf() msgbox "reversed "+vbar.reverse() msgbox "sorted " +vbar.sort() </script> </html>
|
|
|
|