PHP local refresh iframe via IFRAME flush iframe src get elements in iframe

Source: Internet
Author: User
Reg.html
The reg.html page has an IFRAME tag, which is used by the IFRAME to request PHP verification that the user name is available.

<html><head><metacharset="Utf-8"><title>IFrame Local Refresh 
     title
 > 
     Head
 ><body><formMethod="POST"action= "">User name:<inputtype="text"id="uname"name= ' username ' /><spanid="msg"style="color:red;" > 
     span
 > 
     Form
 ><iframeBorder=' 0 'width=' 0 'height= ' 0 ' id=' myiframe ' > 
     iframe
 ><scripttype="Text/javascript">let the IFRAME request check_reg.php document.getElementById (' uname ') when the user name input box loses focus . onblur =   function(){if(this. Value! = ") {Document.getelementby          Id (' Myiframe '). src = ' check_reg.php?username= '+ this. value; }      }     
     Script
 > 
     Body
 > 
     HTML
 >

check_reg.php


    
     header("content-type:text/html;charset=utf-8");$username  = $_GET['username'];if($username == 'admin'){    $msg = '对不起,用户名已被使用!';}else{    $msg = '恭喜!该用户名可以使用。';}echo<<
     <>< span="">
      ?>
     <>

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above introduces PHP through the IFRAME to achieve local refresh, including the content of the IFRAME, I hope that the PHP tutorial interested in a friend helpful.

  • 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.