pelegk1
01-07-2004, 01:40 PM
form javascript and recive a file?
thanks in advance
peleg
thanks in advance
peleg
|
Click to See Complete Forum and Search --> : is it possible to call a vbscript function pelegk1 01-07-2004, 01:40 PM form javascript and recive a file? thanks in advance peleg pnaj 01-07-2004, 07:28 PM See vb <-> js (http://msdn.microsoft.com/library/en-us/dnvid/html/msdn_vbnjscrpt.asp?frame=true#vbnjscrpt_working) for the first half of your question ... don't know what you mean in the second half. pelegk1 01-08-2004, 02:56 AM it it possible for JS to call a VBscript function and recive a value from it? pnaj 01-08-2004, 04:47 AM yes pelegk1 01-08-2004, 05:17 AM i have tried and it isnt working for me thanks in advance peleg pnaj 01-08-2004, 05:23 AM Have a look at the link I provided for an example. pelegk1 01-08-2004, 09:28 AM as calling js from vb:) pnaj 01-08-2004, 10:06 AM Seems easy enough ... <html> <head> <title>Untitled</title> </head> <body> <SCRIPT LANGUAGE="VBSCRIPT"> Function returnValue() returnValue = "Hello, world!" End Function </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function getVBValue(){ var vbval = returnValue(); alert("VBScript value = " + vbval); } getVBValue(); </SCRIPT> </body> </html> pelegk1 01-08-2004, 06:26 PM but when i tried something similer it didnt work:( my example is attached! where did i go wrong? thnaks in advance peleg pnaj 01-09-2004, 11:28 AM Hi peleg, I actually replied to this yesterday, but the post must have glitched ... 1) Put the language tag in ... possibly vbscript is default(?) 2) I think the call to 'zzz' should have the parameter specified ... don't know enough about vbscript to be sure of that either!! But, this seems to be the minimal one that works ... <script language=vbscript> function zzz(val) zzz=val*val end function </script> <script language=javascript> x=zzz(10); alert(x); </script> pelegk1 01-10-2004, 11:56 PM but greT TO SEE IT WORKING:) pelegk1 01-13-2004, 03:19 AM have any idea why my coe didnt work? pnaj 01-13-2004, 08:03 AM Hi peleg, Got to say I don't know for sure. But, there are many undocumented hitches/glitches in scripting (usually something to do with browser compatibility). Also, a script version might not document a particular behaviour, because it is useful to the developer of the scripting language itself in very particular circumstances, but bug-ridden for the user in general circumstances. I don't use vbscript at all, because only IE supports it (as far as I know, anyway). Here's some possibilities of what was wrong with your code: 1) First script was vbscript ... could be that further scripts are considered vbscript unless you specify the language. 2) Defined functions parameters must be included in every call, not optional, as in javascript (I'm sure this is true in Visual Basic ... might carry over into vbscript). That's about it! paul. pelegk1 01-14-2004, 01:45 AM what do u mean byDefined functions parameters must be included in every call pnaj 01-14-2004, 05:22 AM In Js: function hello(name){ ... } ... would allow the call ... hello(); ... even though a parameter is defined for hello(). In vbscript (I think): Function hello(name) ... End Function ... would moan about ... hello() pelegk1 01-14-2004, 05:34 AM i chekced it out and the problem is not only in the missing value but also that "language="javascript"" is written pnaj 01-14-2004, 12:59 PM Hi peleg, Didn't I mention that earlier? 1) Put the language tag in ... To be frank, I think you're always going to have trouble with scripts if you only ever try to do 'minimal' coding ... here's your original ... <script language=vbscript> function zzz(val) zzz=val*val end function </script> <script> x=zzz() ; </script> For the script tag, I always use: <script language="javascript" type="text/javascript"> // ... code here </script> Also, can I ask why you want to use vbscript anyway? On the client-side, only IE can use it. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |