Frågan#1
Hej, hur får jag varje rad att bli unik? så om jag skriver i rad 8 så uppdateras bara den raden? kan man binda dom unikt på något sätt?
function showTimar(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data
// sent from the server and will update
// div section in the same page.
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('timar');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
// Now get the value from user and pass it to
// server script.
var tart = document.getElementById('tart').value;
var queryString = "?tart=" + tart ;
ajaxRequest.open("GET", "2.php" +
queryString, true);
ajaxRequest.send(null);
}
$i = 1;
echo $_REQUEST['tart'];
while($i<=10) {
if(isset($_REQUEST['tart'])) {
$idd = $_REQUEST['tart'];
echo '<input type="text" name="ttart" id="tart" class="field" onchange="showTimar(this.value, ' . $i . ')" value="'. $idd . '" /><br>';
}
else {
echo '<input type="text" name="ttart" id="tart" class="field" onchange="showTimar(this.value, ' . $i . ')" /><br>';
}
$i++;
}