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 enactments do?

    HTML

    <body onload=”onLoadPage()”>

    Javascript

    operation onLoadPage()
    {
    reset();
    // Fixed input centre to the opportunity control “a”:
    document.getElementById(“a”).focus();
    }

    And

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

    Expert Counter-argument

     

    <body onload=”onLoadPage()”>

    “onload” is javascript fuction that is complete instant behind page has been admonished.

    control copy if you probe to impede that fuction is agoing instant on page admonish probe this enactment.

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

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

    }
    </script>
    </head>

    <body onload=”onLoadPage()”>

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

    </body>

    </html>

    “reset()” it is besides a javascript operation that resets appraises of integral elements in a controlm.

    If fuse that enactment this obtain refixed the controlm elements.

    Lets siege an examle of outside reset() operation.

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

    whenfuse this enactment this obtain achieve the span input hustle with appraise which is Input designate:hello and Input DOB: 05/06/2000

    lets siege an copy of reset() fucntion

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

    when fuse this this obtain achieve the span input hustle with broad appraise it resources it resets the appraise on controlm admonish.

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

    This javascript enactment fixeds the centre on element

    lets attend an copy control that

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

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

    when fuse this obtain achieve centre on Input designate extract hustle with wink cursor.

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

    This obtain fixed appraise nature or returns the appraise of the appraise characteristic of a extract opportunity null consequently you fixed the appraise nothig.

    attend the enactment control appraise fixedting nature

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

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

    In primary input hustle fixed the appraise=a beside in operation onadmonish i fixed the appraise nature to broad.

    In secon Input hustle the appraise is showing as it is.