getElementsByTagName Problem Solving

Source: Internet
Author: User
 
  
 
  
 
  
  
   

Chat room (you are chatting with)






 EXECUTE_DML ($sql);} Get the information and assemble the data back to the client (chat room) function getMessage ($getter, $sender) {$sql = "select * from message where getter= ' $getter ' and Sender= ' $sender ' and isget=0 '; $sqlHelper =new sqlHelper (); $array = $sqlHelper->execute_dql2 ($sql); $messageInfo = "
 
  For 
  
   ($i =0; $i < count ($array), $i + +) {$row = $array [$i]; $messageInfo. = " 
   
    {$row [' id ']}
    
   
    {$row [' Sende R ']}
    
   
    {$row [' Getter '}}
    
   
    {$row [' content ']}
    
   
    {$row [' sendtime '] 
   } ";} $messageInfo. = "
 
 
 
 
  
 "; File_put_contents (" D:/test.txt ", $messageInfo." \ r \ n ", file_append); $sqlHelper->close_connect (); return $messageInfo;}}





 
  GetMessage ($getter, $sender),//file_put_contents ("D:/test.txt", "news--". $mesList. " \ r \ n ", file_append); Echo $mesList;? >




Why in the first paragraph of the function GetMessage ()
var cons=mesres.getelementsbytagname ("Con");
Alert is 0. There are records added to the database
I'm looking at the PHP video of Hanshunping.
Ask the great God to rescue


Reply to discussion (solution)

In IE, getelementsbyname () is taken by ID, but in other browsers, it is normally taken by the name attribute, so if your code runs on a non-ie browser, there will be no value.

Sorry, I didn't notice that you wrote getElementsByTagName () you should change to getElementById ()
var Cons=mesres.getelementbyid ("Con");
var Sendtimes=mesres.getelementbyid ("Sendtime");
Besides, you've got a lot of low-level mistakes.
$ (' mycons '). value+= " to say:" +cons[i].childnodes[0].nodevalue+ "" +sendtimes[i].childnodes[0].nodevalue;
PHP code is not executed by the client browser, and you get cons, Sendtimes are just a DOM object, not a result set

Sorry, I didn't notice that you wrote getElementsByTagName () you should change to getElementById ()
var Cons=mesres.getelementbyid ("Con");
var Sendtimes=mesres.getelementbyid ("Sendtime");
Besides, you've got a lot of low-level mistakes.
$ (' mycons '). value+= "

Thank you very much for your guidance. Novice, I know what the problem is today.

Header ("Conntent-type:text/xml;charset=utf-8");    Header ("Cache-control:no-cache");

This is content-type a dozen more N.
  • Related Article

    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.