Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- *************************************************************************
- ********************* THIS IS THE CONTACT FORM JS **************************
- ************************************************************************** -->
- <script type='text/javascript'>
- $(document).ready(function(){
- var active_color = '#929191'; // Colour of user provided text
- var inactive_color = '#929191'; // Colour of default text
- $("input.default-value").css("color", inactive_color);
- var default_values = new Array();
- $("input.default-value").focus(function() {
- if (!default_values[this.id]) {
- default_values[this.id] = this.value;
- }
- if (this.value == default_values[this.id]) {
- this.value = '';
- this.style.color = active_color;
- }
- $(this).blur(function() {
- if (this.value == '') {
- this.style.color = inactive_color;
- this.value = default_values[this.id];
- }
- });
- });
- $('#contactform').submit(function(){
- formvalues = $("#contactform").serialize();
- $.ajax({
- type: "POST",
- url: "mailer.php",
- data: formvalues,
- dataType: "json",
- success: function(data) {
- if (data.success==1) {
- $("#contactwrapper").slideUp(750,function() {
- $('#contactmessage').html('Thanks! Please check your email to confirm your subscription.');
- });
- }
- else{
- if (data.invalid_email==1) { $('#contact_email').addClass("form_error"); }
- else { $('#contact_email').removeClass("form_error"); }
- }
- }
- });
- return false;
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement