Why is the value of the first value obtained every time?

Source: Internet
Author: User
Why is the value of the first value obtained every time? & lt ;? Php & nbsp; while ($ row = mysql_fetch_array ($ query) & nbsp ;{& nbsp ;? & Gt; & nbsp why is the value of the first value obtained every time?
While ($ row = mysql_fetch_array ($ query ))
{
?>





"Size =" 10 "maxLength =" 4 "onblur =" check ( ) "> (Note: a maximum of four words can be entered !)
"Size =" 70 "onblur =" check1 ( ) ">



  }
?>



Function check (id)
{
Var tit = document. getElementById ('title'). value;
Alert (tit );
S_xmlhttprequest (); // The above object can be used.
XmlHttp. open ("GET", "changeLink. php? Title = "+ tit +" & id = "+ id, true); // XMLHttpRequest. open (transfer method, address, asynchronous request or not)
XmlHttp. onreadystatechange = byphp; // ready for execution. call the following method:
XmlHttp. send (null); // send
}
Function check1 (id)
{
Var lin = document. getElementById ('link'). value;
S_xmlhttprequest (); // The above object can be used.
XmlHttp. open ("GET", "changeLink. php? Link = "+ lin +" & id = "+ id, true); // XMLHttpRequest. open (transfer method, address, asynchronous request or not)
XmlHttp. onreadystatechange = byphp; // ready for execution. call the following method:
XmlHttp. send (null); // send
}


// Why did I get the id when I first modified it? I have different IDs in each row and should get the values corresponding to different IDs, after a long time, I still don't know what to do. please give me some advice. thank you!
------ Solution --------------------
The title IDs output by loop are the same, so you can only obtain the first title.

"Value =" "Size =" 10 "maxLength =" 4 "onblur =" check ( ) ">

Function check (id)
{
Var tit = document. getElementById ('title' + id). value;
Alert (tit );
...............

The same is true for the link below.
------ Solution --------------------
Reference:
The title IDs output by loop are the same, so you can only obtain the first title.

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.