sterni
20.04.2012, 14:59
Hallo
kann mir jemand sagen warum mein script nicht richtig läuft
UserPoints = "<?php echo $userpoints ;?>";
Vorhanden = "<?php echo $vorhanden; ?>"
Tageskurs = "<?php echo $tageskurs; ?>"
MSG1 = "<?php echo JText::_('BON_NOTALLOWED');?>";
MSG2 = "<?php echo JText::_('BON_BLANK');?>";
function calculate(){
var wieviel1 = Number(document.getElementById("wieviel1").value*100);
var wieviel2 = Number(document.getElementById("wieviel2").value*10);
var wieviel3 = Number(document.getElementById("wieviel3").value*1);
var total = Number(wieviel1*100+wieviel2*10+wieviel3*1)/Tageskurs;
var taler = Number(wieviel1*100+wieviel2*10+wieviel3*1)/Tageskurs;
if((total>UserPoints) || (total>Vorhanden)){
var msg = MSG1;
document.getElementById("msg").value = msg;
document.getElementById("msg").style.color = "red";
document.getElementById("wieviel1").style.backgroundColor = "#ff9999"
document.getElementById("wieviel2").style.backgroundColor = "#ff9999"
document.getElementById("taler").style.backgroundColor = "#ff9999"
} else {
var msg = MSG2;
document.getElementById("total").value = total.toFixed();
document.getElementById("taler").value = taler.toFixed();
document.getElementById("msg").value = msg;
document.getElementById("msg").style.color = "#000000";
document.getElementById("total").style.color = "#000000";
document.getElementById("wieviel1").style.backgroundColor = "#ffffff"
document.getElementById("wieviel2").style.backgroundColor = "#ffffff"
document.getElementById("taler").style.backgroundColor = "#ffffff"
}
}
wenn ich nur total>UserPoints oder total>Vorhanden kappt es
ich will aber das er beides prüft und ggf. den fehler ausgibt.
kann mir jemand sagen warum mein script nicht richtig läuft
UserPoints = "<?php echo $userpoints ;?>";
Vorhanden = "<?php echo $vorhanden; ?>"
Tageskurs = "<?php echo $tageskurs; ?>"
MSG1 = "<?php echo JText::_('BON_NOTALLOWED');?>";
MSG2 = "<?php echo JText::_('BON_BLANK');?>";
function calculate(){
var wieviel1 = Number(document.getElementById("wieviel1").value*100);
var wieviel2 = Number(document.getElementById("wieviel2").value*10);
var wieviel3 = Number(document.getElementById("wieviel3").value*1);
var total = Number(wieviel1*100+wieviel2*10+wieviel3*1)/Tageskurs;
var taler = Number(wieviel1*100+wieviel2*10+wieviel3*1)/Tageskurs;
if((total>UserPoints) || (total>Vorhanden)){
var msg = MSG1;
document.getElementById("msg").value = msg;
document.getElementById("msg").style.color = "red";
document.getElementById("wieviel1").style.backgroundColor = "#ff9999"
document.getElementById("wieviel2").style.backgroundColor = "#ff9999"
document.getElementById("taler").style.backgroundColor = "#ff9999"
} else {
var msg = MSG2;
document.getElementById("total").value = total.toFixed();
document.getElementById("taler").value = taler.toFixed();
document.getElementById("msg").value = msg;
document.getElementById("msg").style.color = "#000000";
document.getElementById("total").style.color = "#000000";
document.getElementById("wieviel1").style.backgroundColor = "#ffffff"
document.getElementById("wieviel2").style.backgroundColor = "#ffffff"
document.getElementById("taler").style.backgroundColor = "#ffffff"
}
}
wenn ich nur total>UserPoints oder total>Vorhanden kappt es
ich will aber das er beides prüft und ggf. den fehler ausgibt.