www.webdeveloper.com
Results 1 to 8 of 8

Thread: HTML onLoad Event Not firing on some machines

  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Exclamation 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.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    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
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    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.

  4. #4
    Join Date
    Nov 2010
    Posts
    3
    ---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>

  5. #5
    Join Date
    Nov 2010
    Posts
    3
    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.
    Last edited by Stewart.Blair; 11-12-2010 at 05:57 AM. Reason: More info...

  6. #6
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    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. language=javascript 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:
    Code:
    <tag attribute=" " onevent=" ">
    That means: use lowercase for tags, attributes and events. And nest in quotes, usually double, their values.

    4. What is that for?
    Code:
    AutoItXDLL.WinClose("Launching PASWEB. Please wait ...","");
    I don't see any AutoItXDLL object nor a WinClose() method around.

    Note. No offense but: For God's sake, how long are you going to use IE6? 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 break there? Break what? Returns what?

    And test first your document/link at:
    http://validator.w3.org/

  7. #7
    Join Date
    Jun 2005
    Location
    United Kingdom
    Posts
    1,043
    Quote Originally Posted by Kor View Post
    ........
    Note. No offense but: For God's sake, how long are you going to use IE6....
    For those of us who may have, or wish to have, UK Government visitors for quite a while yet.

    ....It is therefore more cost effective in many cases to continue to use IE6 ....

  8. #8
    Join Date
    Nov 2010
    Posts
    3
    I would validate your code first then test the onload event.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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



Recent Articles