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

    HTML

    <body onload=”onLoadPage()”>

    Javascript

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

    And

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

    Expert Confutation

     

    <body onload=”onLoadPage()”>

    “onload” is javascript fuction that is consummate next following page has been inculpateed.

    coercion development if you aim to obstruct that fuction is instituted next on page inculpate aim this regulation.

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

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

    }
    </script>
    </head>

    <body onload=”onLoadPage()”>

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

    </body>

    </html>

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

    If rush that regulation this succeed refirm the coercionm elements.

    Lets select an examle of outside reset() employment.

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

    whenrush this regulation this succeed attain the span input punch with rate which is Input designate:hello and Input DOB: 05/06/2000

    lets select an development of reset() fucntion

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

    when rush this this succeed attain the span input punch with bleak rate it instrument it resets the rate on coercionm inculpate.

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

    This javascript regulation firms the rendezvous on element

    lets view an development coercion that

    <html>
    <head>
    <script type=”text/javascript”>
    employment 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 rush this succeed attain rendezvous on Input designate passage punch with connive cursor.

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

    This succeed firm rate ownership or receipts the rate of the rate indication of a passage scope ineffectual accordingly you firm the rate nothig.

    view the regulation coercion rate firmting ownership

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

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

    In pristine input punch firm the rate=a save in employment oninculpate i firm the rate ownership to bleak.

    In secon Input punch the rate is showing as it is.