PHP-click Change Avatar

Source: Internet
Author: User

Principle:

Operation Flow:

First click on the avatar image, pop up the selection window, select one of the window to launch avatar replacement.

Effect:

Main Page code:

<tr> <td> Avatar:</td> <td><input type="Hidden"Name=" Face"Value=""/> "./face/m01.gif"alt="Avatar" class=" Face"Id='faceimg'onclick="javascript:window.open (' face.php ', ' face ', ' Width=420,height=600,top=0,left=0,scrollbars=1 ');"/></td></tr>

Child page code (popup form page):

    <div id="face">        foreachas  $num) {                    "". $num."' alt= ' face /". $num."' title= '". $num."'/>' ;            }? >    </div>

Use the JS code:
Reference:

    <!--Click Change Avatar    --<script type="text/javascript" src= "./js/ Face.js"></script>    

Code:

Window.onload =function () {//get the Avatar object in the face.php page    varimg = document.getElementsByTagName ('img'); //to cycle     for(i=0; i){        //trigger A Click event on the selected objectImg[i].onclick =function () {//Call the _opener () function_opener ( This. alt);    }; }}//Show Avatar functionfunction _opener (src) {//Get parent page Avatar Object    varFaceimg = Opener.document.getElementById ('faceimg'); //Change your avatar's imgFACEIMG.SRC =src; //Change the value of name in the register form in the parent page to SRC. Opener.document.register.face.value =src;}

PHP-click Change Avatar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.