Maison >développement back-end >tutoriel php >php使用post动态选择头像和js事件动态改变头像,postjs_PHP教程
<html> <head> <meta http-equit="Content-type" content="text/html" charset="utf-8"> <title>动态选择头像logo</title> <script type="text/javascript"> <span>function</span><span> check(obj){ $(</span>"showImage").src = obj.<span>value; } </span><span>function</span><span> $(obj){ </span><span>return</span> document.<span>getElementById(obj); } </span></script> </head> <body> <?<span>php </span><span>echo</span> '<img src="'.<span alt="php使用post动态选择头像和js事件动态改变头像,postjs_PHP教程" >$_POST</span>['mylogo'].'">; </span>?> <img id="showImage" src="1.png" style="max-width:90%" alt="php使用post动态选择头像和js事件动态改变头像,postjs_PHP教程" > <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>