/    Sign up×
Community /Pin to ProfileBookmark

vbscript stops javascripts

This script for some reason stops all my javascripts from running right, It works right so whats happening? Can this VBscript be converted to javascript?

<head>
<script language=VBScript>
Dim Bar, Line, SP
Bar = 0
Line = “|”
SP = 100

Function Window_onLoad()
Bar = 95
SP = 10
End Function

Function Count()
If Bar < 100 Then
Bar = Bar + 1
Window.Status = “Loading : ” & Bar & “%” & ” ” & String(Bar, Line)
setTimeout “Count()”, SP
Else
Window.Status = “TodayLoad.com • Central Of Exchange”
Document.Body.Style.Display = “”
End If
End Function

Call Count()
</script>

</head>

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceFeb 22.2006 — Using mixed scripting languages in the same page is not a problem. The only thing extra you have to do is to make sure that all of your inline HTML event handler attributes specify the desired language via the appropriate psuedo-protocol notation. This is so that the browser knows what language to use for generating the associated anonymous function.

<img ...etc... onclick="javascript: ...">

<input type=button ...etc... onclick="vbscript: ...">
Copy linkTweet thisAlerts:
@TheBearMayFeb 22.2006 — Not sure why it would stop execution, but this JS should be pretty close to what the VB is doing.
&lt;script type="text/javascript"&gt;
var Bar, Line, SP;
Bar = 0;
Line = "|";
SP = 100;

function Window_onLoad(){
Bar = 95;
SP = 10;
}
document.onload=Window_onLoad();

function Count(){
var sBar;
if (Bar &lt; 100){
Bar++;
sBar="";
for (i=0;i&lt;Bar;i++){
sBar+=Line;
}
window.status = "Loading : " + Bar + "%" + " "+sBar;
setTimeout ("Count()", SP);
}
else {
window.status = "TodayLoad.com • Central Of Exchange";
document.body.style.display = "";
}
}

Count()
&lt;/script&gt;
Copy linkTweet thisAlerts:
@phpnoviceFeb 22.2006 — I don't know if this is an accident, but it is incorrect:

document.onload=Window_onLoad();

That should be more like this (two changes):

window.onload = Window_onLoad;
Copy linkTweet thisAlerts:
@ranosbauthorFeb 22.2006 — Yes phpnovice you are correct...

window.onload = Window_onLoad;

Thanks heaps TheBearMay that works like the vb.

What was happening is the vb would work, but all my js scripts and css that used the mouseover events would'nt respond to the events after the page loaded.

Menus didnt open and css mouseover background changes didn't change. All scripts have their approprate titles

<script type="text/javascript">

<script language=VBScript>

confused...
Copy linkTweet thisAlerts:
@gphFeb 23.2006 — Menus didnt open and css mouseover background changes didn't change. All scripts have their approprate titles

<script type="text/javascript">

<script language=VBScript>

confused...[/QUOTE]

My guess is the vbs appeared in the document before the js.
Copy linkTweet thisAlerts:
@ranosbauthorFeb 23.2006 — Yes the vbscript was first, must it be after all js files and why?
Copy linkTweet thisAlerts:
@phpnoviceFeb 23.2006 — Just follow this advice I gave you at first.
Using mixed scripting languages in the same page is not a problem. The only thing extra you have to do is to make sure that all of your inline HTML event handler attributes specify the desired language via the appropriate psuedo-protocol notation. This is so that the browser knows what language to use for generating the associated anonymous function.

<img ...etc... onclick="javascript: ...">

<input type=button ...etc... onclick="vbscript: ...">[/QUOTE]
Copy linkTweet thisAlerts:
@felgallFeb 23.2006 — Just remember that the VB will only run in IE as real web browsers only understand Javascript.
Copy linkTweet thisAlerts:
@gphFeb 24.2006 — Yes the vbscript was first, must it be after all js files and why?[/QUOTE]
The default scripting language for IE is js. If it first reads another language like vbs it, without specific direction, applies that language to the event handlers it encounters later in the page.

There are lots of ways to specify which language handles which event but you don't need to if you load the js first. js is better at events anyway so just load vbs last and use it for some of the non-event things it does better than js.
Copy linkTweet thisAlerts:
@ranosbauthorFeb 25.2006 — Great! Thanks all for educating me...
Copy linkTweet thisAlerts:
@gphFeb 25.2006 — Good to see you understand ranosb. I want to qualify this statement.
load vbs last and use it for some of the non-event things it does better than js.[/QUOTE]
Any MS application or windows scripting can be done in both languages though you might not think so because most examples are in vbs. The vbs I use are functions specific to the vbs language.

These functions either do what js can't or do it better. They are MsgBox, FormatCurrency, MonthName and DatePart.
×

Success!

Help @ranosb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...