function viewTest(testId) { if (testId != '') { window.location.href = 'index.php?subject=&page=&action=view-test&test=' + testId; } else { window.location.href = 'index.php?subject=&page='; } } function deleteTest(testId) { if (confirm('Delete this image?')) { window.location.href = 'index.php?subject=&page=&action=delete&test=' + testId; } } function checkSpace(n){ ers=''; for (i=1; i<=n; i++){ var inp='in'+i; input = document.getElementById(inp).value; var lastPos = input.substring(input.length-1); document.getElementById(inp).style.backgroundColor='#FFFFFF'; if(input==''||input==null){ //ers= ers + '\n' + i + '. No answer'; //document.getElementById(inp).style.backgroundColor='yellow'; } if(input.indexOf(' ')!=-1){ ers=ers + '\n' + i + '. Spaces!'; document.getElementById(inp).style.backgroundColor='yellow'; } if(lastPos==' '){ ers=ers + '\n' + i + '. Spaces at the end!'; document.getElementById(inp).style.backgroundColor='yellow'; } if(input.charAt(0)==' '){ ers=ers + '\n' + i + '. Spaces in the beginning!'; document.getElementById(inp).style.backgroundColor='yellow'; } } if(ers!=''){ alert(ers) return false; } }