Answers for "onclick radio button show hide div"

1

onclick radio button show hide div

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
        <script type="text/javascript">
            function show(str){
                document.getElementById('sh2').style.display = 'none';
                document.getElementById('sh1').style.display = 'block';
            }
            function show2(sign){
                document.getElementById('sh2').style.display = 'block';
                document.getElementById('sh1').style.display = 'none';
            }
        </script>
    </head>

    <body>
        <p>
            <input type="radio" name="r1" id="e1" onchange="show2()"/> I Am New User   
            <input type="radio" checked="checked" name="r1" onchange="show(this.value)"/> Existing Member
        </p>
        <div id="sh1">Hello There !!</div>
        <p> </p>
        <div id="sh2" style="display:none;">Hey Watz up !!</div>
    </body>
</html>
Posted by: Guest on June-11-2021
0

show and hide divs based on radio button click

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
        <script type="text/javascript">
            function show(str){
                document.getElementById('sh2').style.display = 'none';
                document.getElementById('sh1').style.display = 'block';
            }
            function show2(sign){
                document.getElementById('sh2').style.display = 'block';
                document.getElementById('sh1').style.display = 'none';
            }
        </script>
    </head>

    <body>
        <p>
            <input type="radio" name="r1" id="e1" onchange="show2()"/> I Am New User   
            <input type="radio" checked="checked" name="r1" onchange="show(this.value)"/> Existing Member
        </p>
        <div id="sh1">Hello There !!</div>
        <p> </p>
        <div id="sh2" style="display:none;">Hey Watz up !!</div>
    </body>
</html>
Posted by: Guest on May-23-2021

Code answers related to "onclick radio button show hide div"

Browse Popular Code Answers by Language