I will try in a new more specific attempt. I’m trying to get the value for my <span id=”$var”>BadText</span>
from a variable. Passing the idFull to the function works fine by first writing the value to a JS variable. But in the span area doesn’t work. I always get “document.getElementById(...) is null“. May you have a solution there? I already crossed my Mind but I found no clue. For me it looks like a problem with the scope of variables or the order of execution.
function transferFader(value,id)
{
if (window.XMLHttpRequest)
{
// AJAX nutzen mit IE7+, Chrome, Firefox, Safari, Opera
xmlhttp=new XMLHttpRequest();
}
else
{
// AJAX mit IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("result"+id).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","backEnd.php?v="+value+"&id="+id,true);
xmlhttp.send();
return;
}
<?
function slider(){
echo('
var idFull = "123";
var idFullResult = "result123";
<form oninput="transferFader(auswertung.value,idFull)">
<input type="range" name="auswertung" min="0" max= "63" value="30" orient="vertical">
<br>
<span id=idFullResult>n.a.</Span>
</form>
');
}
slider();
?>