Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


javascript not vbs!!!

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,39066
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> javascript not vbs!!!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 javascript not vbs!!! - 10/24/2006 3:07:18 AM   
  swiftoid


Posts: 31
Score: 0
Joined: 10/20/2006
Status: offline
I have now come across this problem a few time. If you have a vbs script on a page the browser assumes that the rest of any code on the page will also be in vbs not Javascript.
For example say I had:
<SCRIPT LANGUAGE="VBScript" src="vb_file.vbs"></script>
and then:
<script>
alert('hi!');
</script>

it would throw up an error becuase it thinks it's vbs not Javascript. THis is easily sovled by putting type='text/javascript in the script tag.
What do I do though when I am using onclick and onchange in an input?
I have the following code:
<td><input  type=text value="" name="date" size=6   onchange="saveCh(document.form1.date.value,   'date', 'id');">
but becuase I have:
<SCRIPT LANGUAGE="VBScript" src="vb_file.vbs"></script>
earlier on it the code it proccesses the onchange bit as vbs not Javascript and throws up the error:
cannot use parentheses when calling a sub
How can I get it to proccess as Javascript?

< Message edited by swiftoid -- 10/24/2006 3:08:22 AM >


_____________________________

Jamie Swift
<!---The Swiftanator---!>
www.swiftscripts.co.uk
 
 
Post #: 1
 
 RE: javascript not vbs!!! - 10/24/2006 3:23:25 AM   
  TNO


Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
When i first started mixing and matching the two languages I came across a similar problem (now I program entirely in one language or the other depending on the circumstance).

But to alleviate your issue, do this:

onchange="vbscript://saveCh(document.form1.date.value,   'date', 'id')"

onchange="javascript://saveCh(document.form1.date.value,   'date', 'id')"

I THINK you can also do this:

<input  type=text value="" name="date" size=6 language="JavaScript"   onchange="saveCh(document.form1.date.value,   'date', 'id');">

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to swiftoid)
 
 
Post #: 2
 
 RE: javascript not vbs!!! - 10/24/2006 3:54:54 AM   
  swiftoid


Posts: 31
Score: 0
Joined: 10/20/2006
Status: offline
Thanks for that. I tried out your first suggestions and found a small fault in it.
It's not:
javascript://savech..
it's:
javascript:savech..
 
I did briefly try your other suggestion but this didn't seem to work, might just have been me though as I was using a replace() function to do it. Thanks for everything.

_____________________________

Jamie Swift
<!---The Swiftanator---!>
www.swiftscripts.co.uk

(in reply to TNO)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> javascript not vbs!!! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts