Jump to content
php.lv forumi

Palīdziet,kur šeit ir kļūda?


Eddy73

Recommended Posts

<html>

<body>

<body>

<script language="JavaScript">

<!--

function formCheck(formobj){

// Enter name of mandatory fields

var fieldRequired = Array("Password","accsept","sex");

// Enter field description to appear in the dialog box

var fieldDescription = Array("Please enter your Password","Please accsept-Terms and conditions","Please enter your gender");

// dialog message

var alertMsg = "Please complete the following fields:\n";

 

var l_Msg = alertMsg.length;

 

for (var i = 0; i < fieldRequired.length; i++){

var obj = formobj.elements[fieldRequired];

if (obj){

switch(obj.type){

case "select-one":

if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "select-multiple":

if (obj.selectedIndex == -1){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "text":

case "textarea":

if (obj.value == "" || obj.value == null){

alertMsg += " - " + fieldDescription + "\n";

}

break;

default:

}

if (obj.type == undefined){

var blnchecked = false;

for (var j = 0; j < obj.length; j++){

if (obj[j].checked){

blnchecked = true;

}

}

if (!blnchecked){

alertMsg += " - " + fieldDescription + "\n";

}

}

}

}

 

if (alertMsg.length == l_Msg){

return true;

}else{

alert(alertMsg);

return false;

}

}

// -->

</script>

<form name="formcheck" onsubmit="return formCheck(this);">

<br/>

Password: <input type=password name="Password" style="left: 271px; top: 482px; width: 160px; height: 19px;background-color:lightblue;">(Must contain atleast 1 digit and 5 letters)

<br/>

<input type="radio" name="sex" value="male" /> Male

<input type="radio" name="sex" value="female" /> Female

<br/>

<small style="font-family;color:red"><b>I have Have read and agree to</small><a href="user terms.htm" target="_blank" style="font-family;color:red">User Terms and Conditions.</a>

<input type="checkbox" name="accsept" value="Yes" /><br/><br/>

<form name="input" action="html_form_submit.asp" method="get">

<input type="submit" value="Submit Form">

</form>

</body>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...