Homework Solution: What do these codes do?…

    What do these codes do? HTML <body onload="onLoadPage()"> Javascript function onLoadPage() { reset(); // Set input focus to the field for "a": document.getElementById("a").focus(); } And document.getElementById("a").value = "";

    Expert Answer

     
    <body onload="onLoadPage()"> "onload" is javascript fuction th

    What do these commands do?

    HTML

    <body onload=”onLoadPage()”>

    Javascript

    exercise onLoadPage()
    {
    reset();
    // Firm input standpoint to the scope coercion “a”:
    document.getElementById(“a”).focus();
    }

    And

    document.getElementById(“a”).compute = “”;

    Expert Counterpart

     

    <body onload=”onLoadPage()”>

    “onload” is javascript fuction that is enact direct behind page has been admonished.

    coercion specimen if you endeavor to curb that fuction is established direct on page admonish endeavor this command.

    <html>
    <head>
    <script type=”text/javascript”>
    exercise onLoadPage(){

    alert(“Hello i am on page admonish”);

    }
    </script>
    </head>

    <body onload=”onLoadPage()”>

    Input spectry:<input type=”text” id=”a” spectry=”heelo”>

    </body>

    </html>

    “reset()” it is besides a javascript exercise that resets computes of complete elements in a coercionm.

    If escape that command this obtain refirm the coercionm elements.

    Lets choose an examle of extraneously reset() exercise.

    <html>
    <head>
    </head>
    <body>
    Input spectry:<input type=”text” id=”a” compute=”hello”><br><br>
    Input DOB:<input type=”text” id=”b” compute=”05/06/2000″>
    </body>
    </html>

    whenescape this command this obtain obtain the brace input smack with compute which is Input spectry:hello and Input DOB: 05/06/2000

    lets choose an specimen of reset() fucntion

    <html>
    <head>
    <script type=”text/javascript”>
    exercise onLoadPage()
    {
    reset();
    }
    </script>
    </head>
    <body>
    Input spectry:<input type=”text” id=”a” compute=”heelo”><br><br>
    Input DOB:<input type=”text” id=”b” compute=”05/06/2000″>
    </body>
    </html>

    when escape this this obtain obtain the brace input smack with broad compute it resources it resets the compute on coercionm admonish.

    document.getElementById(“a”).focus();

    This javascript command firms the standpoint on element

    lets perceive an specimen coercion that

    <html>
    <head>
    <script type=”text/javascript”>
    exercise onLoadPage()
    {
    document.getElementById(“a”).focus();
    }
    </script>
    </head>

    <body onload=”onLoadPage()”>
    Input spectry:<input type=”text” id=”a” spectry=”a”><br><br>
    Input DOB:<input type=”text” id=”b” spectry=”b”>
    </body>
    </html>

    when escape this obtain obtain standpoint on Input spectry passage smack with overlook cursor.

    document.getElementById(“a”).compute = “”;

    This obtain firm compute quality or receipts the compute of the compute mark of a passage scope trifling owing you firm the compute nothig.

    perceive the command coercion compute firmting quality

    <html>
    <head>
    <script type=”text/javascript”>
    exercise onLoadPage()
    {
    document.getElementById(“a”).compute =””;
    }
    </script>
    </head>

    <body onload=”onLoadPage()”>
    Input spectry:<input type=”text” id=”a” compute=”a”><br><br>
    Input DOB:<input type=”text” id=”b” compute=”b”>
    </body>
    </html>

    In foremost input smack firm the compute=a barring in exercise onadmonish i firm the compute quality to broad.

    In secon Input smack the compute is showing as it is.