-
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
-
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks