/    Sign up×
Community /Pin to ProfileBookmark

HTML onLoad Event Not firing on some machines

Hi There.

I have a htm page that takes in an entry from the user in an input box.

On the onLoad event i go and check whether the user has a value in for their username and password, passed into from a seperate application.

If they have a valid username and password I set the focus to be the CCI.Input box where the user enters in the CCI number of the printer they want to print to.

On some machines the on load event is not firing. I have found this by using the alert function in the onLoad function on my machine it pops up, on other machines it pops up but in a small handfull it does not pop up.

If i F5 the page it triggers the onLoad event and the CCI input box gets the focus. I am just a bit perplexed ?? as to why on some machines it will not fire.

There is an error popping up saying permission denied and when it is refreshed it gets rid of this.

I am running IE6 on my machine, the machine that it is not working is an IE6 machine.

Any help or hints would be greatly appreciated.

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@FangNov 12.2010 — http://support.microsoft.com/kb/234067/EN-US

or as this appears to be on an intranet, Internet Options > Browser History > Always Refresh from Server
Copy linkTweet thisAlerts:
@KorNov 12.2010 — No way. There are some problem with onload event in FF, but only when the user turns back using the back button. Otherwise, no, as far as I know.

The same browser, on the same Operation System will do always the same things, on different machines.

Post your code HTML and JavaScript (or the relevant part of it) or a link to a test page, and tell us exactly on which browsers onload does not fire. And when.
Copy linkTweet thisAlerts:
@Stewart_BlairauthorNov 12.2010 — ---I have stripped out the bits you dont need --- but this is all the bits that is needed.

<html>

<head>

<title>Launching PASWEB. Please wait ...</title>

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="Expires" CONTENT="-1">

<script language=javascript>

// ======================================================================
// Script Function: To automatically log into PASWEB System
//
// Requires: AutoIt Version 3.2.12.1 in the form of a registered dll file
//
// Author: Stewart Blair
//
// Created: 10/11/2010
//
// ======================================================================
var username = "<&#37;=Request.username%>";
var password = "<%=Request.password%>";
var patientid = "<%=Request.patientId%>";
var pathToExecutable = "<%=Request.pathToExecutable%>";
var winVersion = "";


function numbersonly(myfield, e, dec)

{

var key;

var keychar;

if (window.event)

key = window.event.keyCode;

else if (e)

key = e.which;

else

return true;

keychar = String.fromCharCode(key);

// control keys

if ((key==null) || (key==0) || (key==8) ||

(key==9) || (key==13) || (key==27) )

return true;

// numbers

else if ((("0123456789").indexOf(keychar) > -1))

return true;

// decimal point jump

else if (dec && (keychar == "."))

{

myfield.form.elements[dec].focus();

return false;

}

else

return false;

}

function checkInternetBrowserVersion(){

var browserName = navigator.appName;

// Test for Microsoft IE browser

if (browserName=="Microsoft Internet Explorer")

{

//var showButton = false;

var appversion = navigator.appVersion.toString();

var listArray = appversion.split(";");

var entryArray;
// loop round appversion
for (var i = 0; i < listArray.length; i++) {

// split up value where possible by a space
entryArray = listArray[i].split(" ");

// test first part of array for MSIE

if (entryArray[1].toUpperCase() == "MSIE") {

// Test the second part for IE version

if (parseFloat(entryArray[2]) == 6 ) {
winVersion = "6";
// everything ok
break;

}
if (parseFloat(entryArray[2]) == 7 ) {
winVersion = "7";
// everything ok
break;

}
}

}
}


//alert(winVersion);

}

function checkusernameandpassword(){

if((username == "") || (password == "")) {

alert("Problem loading Pasweb: check that your username and password are entered in the Clinical Portal My Details Page.");

window.close();

return;

}

document.forms.input.CCI.focus()

}

function CheckValid() {

var CCInumber = document.getElementById('CCI').value

if (CCInumber == "") {
alert("Problem loading Pasweb: You must complete the CCI box. Please Relaunch and Enter Your CCI Number");
document.forms.input.CCI.focus()

window.close();

AutoItXDLL.WinClose("Launching PASWEB. Please wait ...","");

return;

}



loadPASWEB()

}

function loadPASWEB() {
checkInternetBrowserVersion();
var CCInumber = document.getElementById('CCI').value

}






</script>
</head>
<body OnLoad="checkusernameandpassword()">

<form name="input" onsubmit="CheckValid()">

<TABLE BORDER CELLPADDING=3>

<TR>

<td BGCOLOR="#AACCFF"><NOBR>Please Enter Your CCI Number ...<input type="text" name="CCI" id = "CCI" SIZE=4 maxlength="4" onKeyPress="return numbersonly(this, event)" /></NOBR></td>

<td BGCOLOR="#AACCFF"><NOBR><input type="Button" enabled ="false" VALUE="submit" name="SubmitCCI" OnClick="CheckValid()"/> </NOBR></td>

</tr>

</TABLE>

<BR>

<TABLE>

<tr>

<td><FONT COLOR="RED"><B>IMPORTANT: Please enter the correct CCI for your PC. </FONT COLOR></B> </td>

</tr>

<tr>

<td>

<FONT COLOR="RED"><B>A label should be attached to the PC showing this number.</FONT COLOR></B>

</td>

</tr>

<tr>

<td><FONT COLOR="RED"><B>This number determines the printer your PAS labels, letters and OCS request forms are sent to. </FONT COLOR></B></td>

</tr>

<tr>

<td><FONT COLOR="RED"><b>Entering a different CCI number may result in your labels and letters being </FONT COLOR></B></td>

</tr>

<tr>

<td>

<FONT COLOR="RED"><B>printed in a different department/hospital.</FONT COLOR></B>

</td>

</tr>

</TABLE>

</form>

<span style="font-family:arial;font-size:10pt;"></span>

<object classid=clsid:1A671297-FA74-4422-80FA-6C5D8CE4DE04

id=AutoItXDLL VIEWASTEXT>


</object>
</body>

</html>
Copy linkTweet thisAlerts:
@Stewart_BlairauthorNov 12.2010 — My machine is a windows Xp SP3 machine with IE version 6.0.2900.5512

Other test machine is windows xp sp2 with IE version 6.0.2900.2180

Machine not working Win XP sp2 with version 6.0.2900.2180

Although my machine has a diffrent XP sp pack and up to date Browser the 2nd machine is the same as the 3rd and works on the 2nd and not on the 3rd.

I have compared settings and all IE settings are the same accross the board.

If username and password is null then it displays the message Problem loading.......on all machines

If the username and password is not null it does not set the focus of the CCI input box. Only of refreshed does it seem to then set the focus of the input box and will carry on as expected.

Thanks

Am at a loss.
Copy linkTweet thisAlerts:
@KorNov 12.2010 — eeeer. quite a rusty code.

1. you have no Doctype. See: http://www.w3schools.com/tags/tag_doctype.asp. A DTD HTML strict would be enough for you.

  • 2. [I]language=javascript[/I] is deprecated, <script type="text/javascript"> is to be used these days.


  • 3. try using a standard HTML coding style, which proved to be accepted all over the Doctypes, browsers, etc:
    <i>
    </i>&lt;[COLOR="Red"]tag[/COLOR] [COLOR="Red"]attribute[/COLOR]=[COLOR="Blue"]" "[/COLOR] [COLOR="Red"]onevent[/COLOR]=[COLOR="Blue"]" "[/COLOR]&gt;

    That means: use [B]lowercase[/B] for [COLOR="Red"]tags, attributes and event[/COLOR]s. And nest in [B]quotes[/B], [COLOR="Blue"]usually double[/COLOR], their values.


  • 4. What is that for?
    <i>
    </i>AutoItXDLL.WinClose("Launching PASWEB. Please wait ...","");

    I don't see any AutoItXDLL object nor a WinClose() method around.


  • Note. No offense but: [COLOR="Red"][I]For God's sake, how long are you going to use IE6[/I][/COLOR]? Even Microsoft makes for about a whole year an appeal to all of you to switch toward at least IE7, if not straight to IE8 or IE9. What' the use of that IE test? A [B]break[/B] there? Break what? Returns what?

    And test first your document/link at:

    http://validator.w3.org/
    Copy linkTweet thisAlerts:
    @kiwibritNov 12.2010 — ........

    Note. No offense but: [COLOR="Red"][I]For God's sake, how long are you going to use IE6[/I][/COLOR]....[/QUOTE]


    For those of us who may have, or wish to have, UK Government visitors [url=http://www.hmg.gov.uk/epetition-responses/petition-view.aspx?epref=ie6upgrade]for quite a while yet[/url].

    ....It is therefore more cost effective in many cases to continue to use IE6 ....[/quote]
    Copy linkTweet thisAlerts:
    @specialtytasNov 13.2010 — I would validate your code first then test the onload event.
    ×

    Success!

    Help @Stewart_Blair 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.18,
    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,
    )...