简体   繁体   中英

Trigger the image when i click submt button and in current active tab

Trigger the image when i click submt button and in current active tab

<form name="myform" onsubmit="return onsubmitform();">
<input type="submit" name="operation" onclick="document.pressed=this.value"  value="GetCATHY"/>
</form>
<script type="text/javascript">

function onsubmitform()
{

if(document.pressed=='GetCATHY')

{
document.pressed.action="img src=a.jpg";
}

}

You can easily do this using jQuery.

However this is pretty simple stuff so I suggest doing a bit of reading and practice on basic html.

    <!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
        $(document).ready(function(){

            $("#submit").click(function(){
                $("#hidden").show();
            });
        });
    </script>
    <style type="text/css">
        .hidden {
            display: none;
        }
    </style>
</head>
<body>

<form><input type="submit" id="submit"></form>
<div id="hidden" class="hidden">IMAGE</div>


</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM