DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Joshua Guest

    VBScript need in Javascript instead for Mozilla comp.


    I have two simple vbscripts that I need a javascript equivelent in order to
    make compatible with Mozilla/Opera and other browsers.

    Below are the two scripts and I wanted to do the same thing in Javascript.

    <script language="VBScript" type="text/vbscript">
    Sub ChangeStyle()
    set el = window.event.srcElement
    Select Case el.ClassName
    case "cellframe"
    el.ClassName = "cellframeover"
    case "cellframeover"
    el.ClassName = "cellframe"
    End Select
    End Sub

    Sub GoThere()
    set el = window.event.srcElement
    If instr(3,el.id,".") Then
    strLocation = el.id
    Else
    strLocation = el.id & ".asp"
    End IF
    parent.location.href = strLocation
    End Sub
    </script>

    Any help in convertion is appreciated.

    Johsua

  2. #2
    Phil Weber Guest

    Re: VBScript need in Javascript instead for Mozilla comp.

    > I have two simple vbscripts that I need a javascript
    > equivalent in order to make compatible with Mozilla/Opera
    > and other browsers.


    Joshua: I can't guarantee that these will work the same in Mozilla/Opera
    (their DOM implementations may differ from IE's), but the JavaScript should
    be equivalent:

    function changeStyle() {
    var el = window.event.srcElement;
    switch case(el.ClassName) {
    case "cellframe" :
    el.ClassName = "cellframeover"
    break
    case "cellframeover" :
    el.ClassName = "cellframe"
    }
    }

    function goThere() {
    var el = window.event.srcElement;
    if (el.id.substring(2, el.id.length).indexOf(".")) {
    strLocation = el.id;
    } else {
    strLocation = el.id + ".asp";
    }
    parent.location.href = strLocation;
    }

    --
    Phil Weber



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links