Prosim pomoc. Hladam niekoho kto by mi dal dokopy JS. Potreboval by som vložiť funkciu validate do
<form>. JS vyzera takto:
Kód:
function validate()
{
var i = 0;
var invalid = new Array(2);
invalid[0] = "\\";
invalid[1] = "/";
invalid[2] = ":";
invalid[3] = "*";
invalid[4] = "?";
invalid[5] = "<";
invalid[6] = ">";
if( document.file_information.file_name.value == "" ){
alert("You have not entered a filename!");
return false;
}
else if( document.file_information.file_name.value.indexOf(' ') == 0 ) {
alert("First letter can't be a space!");
return false;
}
else
while( i < 7 ) {
if (document.file_information.file_name.value.indexOf(invalid[i]) > -1) {
alert("Sorry, \ / : \" * ? < > and spaces are not allowed.");
return false;
}
i++;
}
return 1;
}
Chcel by som dosiahnut ,aby mi pri odosielani hluposti (ako su v scripte) hlasilo alert. Netusim ako to mam dat do
form. tu je:
Kód:
<form enctype="multipart/form-data" action="nahraj.php" id="form" method="post" onsubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('status').style;b.display='inline';" style="display: inline;">
---blalalalalalala---
</form>