Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Need Javascript instead of VBScript

Posted on 1999-06-30
Medium Priority
Last Modified: 2013-12-25
Can anybody help me - I need Javascript code, that perform same functions as VBScript (see below). Task is easy - there are some frames and I need change conents of one frame from another frame. In VBSCript I did it with Parent object. How can I do that with Javascript?
Sample (change page if language settings was changed in form):
Sub storeItem(item)
   Dim htmsource
   Dim lang
   htmsource=Parent.Frames("tsele").Document.Forms("myf").elements("itm").Value & lang &".htm"
End Sub

Question by:junior_b
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 1863659
Try this, but be sure that all item names are in correct case.  JS is case sensitive.

Assumptions:  'tsele' is the name of the frame containing a form named 'MYF', which, in turn, has items named 'ITM' and 'LNG'.  'tclient' is another frame in the same frameset.

function storeItem(item) {
  var htmsource
  var lang
  parent.tsele.document.MYF.ITM.value = item
  lang = parent.tsele.document.MYF.LNG.value
  htmsource = parent.tsele.document.MYF.ITM.value + lang + ".htm"
  parent.tclient.location = htmsource


Author Comment

ID: 1863660
Thanks, Tom! I find same way just few minutes before (I read Netscape manual on Web). In any case, you can post your comment as an answer (I check my solution with yours :-)). Only additional question - need I explicit define variables in Javascript or not?
By the way, don't you know, will this Javascript code work OK in any browser, or there is some browsers, that can't do that (I think, that VBScript is currently supported by most browsers, but it seems I was wrong. Is the same situation with Javascript?).
Thank you!

Accepted Solution

TTom earned 200 total points
ID: 1863661

I don't think you need to explicitly define the variables in JS (but, then again, I don't think you need to define them explicitly in VBS either unless "option explicit" is specified).  It has never been an issue for me.

IMHO, your code will be 'safer' in JS.  There are some issues with the particular version of JS being used, but I think this particular code is pretty safe.  VBS is supported (currently) only by IE (as far as I know), JS is supported by virtually all the current generation of browsers (and several previous generations).

The only caveat to this is that JavaScript can be disabled at the client level.  In some more paranoid organizations, this can be done because of previous security worries.


Author Comment

ID: 1863662
It seems I have to forget VBS and learn JS - in any case, for client side scripting...

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question