Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript .vs. JavaScript

Status
Not open for further replies.

LadyRose

Programmer
May 17, 2000
16
US
Not all of VbScript works in Netscape.&nbsp;&nbsp;How does one deal with building an app for both environments. <br>Is JavaScript as selective?<br>Can one use Javascipt to deal interactivley with databases?<br>I really appreciate all the help I have gotten from this forum.
 
Hi Rose,<br>&nbsp;&nbsp;&nbsp;What type of problems are you seeing?&nbsp;&nbsp;Since ASP gets processed on the server, and sends HTML to the browser,&nbsp;&nbsp;VBScript will work no matter which browser you're using.&nbsp;&nbsp;Of course,&nbsp;&nbsp;you need to make sure that the HTML you're generating is supported by Netscape, but that's more a matter of your code than the fact that VBScript is generating it.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Well Nick this is what I have:<br><br>&lt;script language=vbscript&gt;<br>Sub cmdSubmit_OnClick()<br> 'The only required fields at this point are<br> 'club name and club code<br> If Len(frmAdd.txtLName.value) = 0 Then<br> Alert &quot;Please Enter Last Name!&quot;<br> frmAdd.txtLName.focus<br> Exit Sub<br> ElseIf Len(frmAdd.txtFName.value) = 0 Then<br> Alert &quot;Please Enter First Name!&quot;<br> frmAdd.txtFName.focus<br> alert &quot;AfterFocus&quot;<br> Exit Sub<br> alert &quot;AfterExit&quot;<br> End If<br> <br> 'If we make this far then submit the form<br> alert &quot;before Submit&quot;<br> Call frmAdd.submit()<br><br>End Sub<br><br>&lt;/script&gt;<br><br><br>Now if I run it in IE, the Alert box pops up and the cursor goes to the blank First name field(assuming it was left blank)&nbsp;&nbsp;This example is very simple.&nbsp;&nbsp;In Netscape it simply does nothing.&nbsp;&nbsp;No Alert box, it does not move to the form action.&nbsp;&nbsp;It just doesn't recognize my OnClick.&nbsp;&nbsp;I am using a course that comes with functional examples.&nbsp;&nbsp;The &quot;instructor's&quot; example functions the same way.&nbsp;&nbsp;So you see, this is why I ask.&nbsp;&nbsp;Maybe there is a little something I can use to tweak this into cooperating?<br><br>Thanks.&nbsp;&nbsp;LadyRose
 
Nick,<br><br>I guess I have to add one thing.&nbsp;&nbsp;This is client side scripting.&nbsp;&nbsp;Does this make a difference in how this is behaving?<br><br>Thanks again. Rose
 
Rose,<br>&nbsp;&nbsp;&nbsp;My mistake.&nbsp;&nbsp;I assumed you were talking server-side code.&nbsp;&nbsp;Netscape does not support VBscript in client scripts.&nbsp;&nbsp;You need to use Javascript in this case.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Ok, Nick<br><br>Your such a fountain of information.&nbsp;&nbsp;Does Javascript handle client side scripting and how would I convert this code.<br><br>'First I am declaring a recordset.<br>Set rs=server.CreateObject(&quot;ADODB.Recordset&quot;)<br>'Open recordset<br>rs.open &quot;AddressBook&quot;,DSN=&quot;Family&quot;,adOpenDynamic,AdLockPessimistic<br><br>'Then filling the table<br>rs(&quot;FName&quot;)=Request.Form(&quot;txtFname&quot;)<br><br>'Update<br>rs.Update&nbsp;&nbsp;Or rs.AddNew depending on what I am doing.<br><br>Of course the two real big questions, Am I going to run into the same kind of problem with javascript as this?&nbsp;&nbsp;And is there another way with vbscript to do this without using client side scripting?<br><br>Thanks again.
 
Rose,<br>&nbsp;&nbsp;&nbsp;Most client side code is written in Javascript, since every browser supports it. If you're using client side code,&nbsp;&nbsp;the server object and the request object aren't available.<br>&nbsp;&nbsp;&nbsp;&nbsp;It's quite unusual to access a database on the user's PC through a web page.&nbsp;&nbsp;Is this really what you're trying to do? <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Nick,<br><br>No I am accessing a database on the server, using client side script.&nbsp;&nbsp;In this case, and address book, where permitted members can add information or change information.<br>Interactive database, actually the course I am working on is ASP Databases.&nbsp;&nbsp;The author uses vbscript, Sql to accomplish the interaction.<br>How does this change things?<br><br>Thanks.
 
Rose:<br><br>Personally, I think your best bet would be to write a server side script that returns a static recordset.&nbsp;&nbsp;it's harder to work with (checking all changes/additions/deletions when the user submits changes) but it solves the compatibility issue.<br><br>p.s. I've only done this with VB6, so I might be totally wrong on this...
 
Rose,<br>&nbsp;&nbsp;&nbsp;&nbsp;To achieve your desired results,&nbsp;&nbsp;you'll need to use both VBscript and Javascript (as well as the standard HTML required for the web page).&nbsp;&nbsp;You use Vbscript on the server to get the data from your database,&nbsp;&nbsp;and generate the code for the web page, including some simple validation to make sure that required fields are filled in, etc.<br>&nbsp;&nbsp;&nbsp;&nbsp;After the form is submitted, you'll again process the results on the server,&nbsp;&nbsp;updating the database as required.&nbsp;&nbsp;Rather than go into a lengthy explanation of the exact steps required,&nbsp;&nbsp;I'd suggest going to <A HREF=" TARGET="_new"> checking out some of the simple database examples,&nbsp;&nbsp;and then come back here with anything that you didn't understand.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top