Change or replace the href of an anchor tag with javascript

With help of java script you can change href of any anchor tag.

Add more button for upload multiple files

Below is the code to upload multiple files with add more button. It shows one browse option.

You need to include jquery min file to execute this code

PHP:

Once the multiple form fields are submitted, then you can get the values as an array in PHP script.

How to reset all fields of a form through JavaScript or jQuery?

In java script form.reset() is a DOM element method (not one on the jQuery object), so you need:
If you want to you use jQuery follow below code

Send array in Ajax with PHP

jQuery : How can I refresh a page ?

How to call on confirm box ?

<html>
<head>
<script type=”text/javascript”>
<!–
function confirmation() {
var answer = confirm(“Action?”)
if (answer){
alert(“ok!”)
window.location = “http://www.google.com/”;
}
else{
alert(“Cancel”)
}
}
//–>
</script>
</head>
<body>
<form>
<input type=”button” onclick=”confirmation()” value=”Submit”>
</form>
</body>
</html>

Simple HTML Form Validation with JavaScript

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Simple JavaScript Form Validation</title>
</head>
<html>

<script language=”JavaScript” type=”text/JavaScript”>

function validation(thisform)
{
if(thisform.Name.value==”)
{
alert(“Name is required.”);
return false;
}
if(thisform.Address.value==”)
{
alert(“Address  is required.”);
return false;
}

//if all is OK submit the form

thisform.submit();
}
</script>
<?php
//Your database insertion  code
?>

<form name=”myform” id=”myform” method=”post”>

<table width=”500″ border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”121″>Name</td>
<td width=”379″><input name=”Name” type=”text” id=”Name” /></td>
</tr>
<tr>
<td>Address</td>
<td><input name=”Address” type=”text” id=”Address” /></td>
</tr>
<tr>
<td><input name=”Submit” type=”button” id=”Submit” onclick=”validationvalidation(this.form)” value=”Submit” /></td>

<td>&nbsp;</td>
</tr>
</table>
</form>

<body>
</body>
</html>

Dynamic function for select all check box

Dynamic function for select all check box

function checkAll(frm1,formid,checkbox_name) {
var aa = document.getElementById(formid);
for (var i =0; i < aa.elements.length; i++)
{
if(aa.elements[i].type == “checkbox” && aa.elements[i].name == checkbox_name)
aa.elements[i].checked = frm1.checked;
}
}

<form id=”check” name=”form1″>
<input type=”checkbox”  name=”check_all” id=”check_all” onclick=”checkAll(document.form1.check_all,’check’,’test[]’)”>
//<input type=”checkbox” onclick=”toggleChecked(this.checked)”>
//For jquery function

All
<input type=”checkbox” name=”test[]” />
1
<input type=”checkbox” name=”test[]” />
2
<input type=”checkbox” name=”test[]” />3
</form>

In Jquery

function toggleChecked(status) {
$(“#checkboxes input”).each( function() {
$(this).attr(“checked”,status);
})
}