php使用post动态选择头像和js事件动态改变头像
<html> <head> <meta http-equit="Content-type" content="text/html" charset="utf-8"> <title>动态选择头像logo</title> <script type="text/javascript"> function check(obj){ $("showImage").src = obj.value; } function $(obj){ return document.getElementById(obj); } </script> </head> <body> <?php echo '<img src="'.$_POST['mylogo'].'" style="padding:10px;">'; ?> <img id="showImage" src="1.png" style="padding:10px;"> <br> <form action="" method="post"> <select name="mylogo" id="id_logo" onchange="check(this)"> <option value="1.png">1.png</option> <option value="2.png">2.png</option> </select> <input type="submit" name="submit" title=""/> </form> </body> </html>
刘华世的官方博客-https://www.pythonschool.com