|
Скрипт "Обратный звонок"!
Всем привет! Столкнулся с такой проблемой! У меня на сайте стоял скрипт "Заказать обратный звонок"! Которая вкладка была расположена с права страницы сайта! При её нажатии открывалось окно и там уже вводишь данные! И решил это делать изменить. Хочу чтобы "Заказать обратный звонок" была как текст на сайте возле номера телефона, а при нажатии этого текста открывалось окно и клиент уже вводил бы данные! Я как слышал это можно сделать с помощью id!
Вот код расположенный на странице: <link rel="stylesheet" href="/callme/callme.css" type="text/css"> <script type="text/javascript" src="/callme/jquery.min.js"></script> <script type="text/javascript" src="/callme/jquery.storage.js"></script> <script type="text/javascript" src="/callme/callme.js"></script> <div id="callme"><input id="viewform" type="button"></div> <div id="callmeform" class="hide-off"><div id="cme_cls"></div><h6><font color="#03539C">Заказать обратный звонок</font></h6> <table cellpadding="0" cellspacing="0"> <tbody><tr><td>Ваше имя</td></tr> <tr><td><input class="txt" maxlength="150" id="cname" value="" type="text"></td></tr> <tr><td>Телефон</td></tr> <tr><td><input class="txt" maxlength="150" value="+7-" id="cphone" type="text"></td></tr> <tr><td>Вопрос или комментарий</td></tr> <tr><td><input class="txt" maxlength="1000" id="ccmnt" type="text"></td></tr> <tr><td> <input class="btn" value="Перезвоните мне" type="button"></td> </tr> </tbody></table> <div id="callme_result"></div> </div> Кто поможет!? Очень надо! Спасибо |
petlyra5, не понял смысла...лучше бы привели код, который у вас был...
проще сделать с помощью кнопки (onClick) или ссылки (на href-атрибут повесить вызов соответствующей функции) |
lord2kim,
Отредактировал первое сообщение! Этот код у меня стоит на сайте! Помогите изменить его! Пример если можно переделанного! |
petlyra5, приведите содержимое callme.js, в котором скорее всего и содержатся основные потроха
|
lord2kim,
jQuery(function(){ jQuery("#viewform").click(function(){ jQuery("#callmeform").fadeToggle("fast"); }); jQuery("#cme_cls").click(function(){ jQuery("#viewform").click(); }); jQuery("#viewform").hover( function () { jQuery(this).addClass("callmeform_hover"); }, function () { jQuery(this).removeClass("callmeform_hover"); } ); }); function sendMail() { var cnt = jQuery.Storage.get('callme-sent'); // getting last sent time from storage if (!cnt) { cnt = 0; } jQuery.getJSON("/callme/index.php", { cname: jQuery("#cname").val(), cphone: jQuery("#cphone").val(), ccmnt: jQuery("#ccmnt").val(), ctime: cnt, url: location.href }, function(data) { message = "<div class='" + data.cls + "'>" + data.message +"</div>"; jQuery("#callme_result").html(message); if (data.result == "success") { jQuery.Storage.set("callme-sent", data.time); jQuery("#callmeform .btn").attr("disabled", "disabled"); setTimeout( function(){ jQuery("#viewform").click(); }, 10000); setTimeout( function(){ jQuery("#callmeform .txt").val(""); }, 10000); } }); // } } jQuery(document).ready(function(){ jQuery("#callmeform .txt").focus(function(){ //jQuery(this).val(""); }); jQuery("#callmeform .btn").click(function(){ jQuery("#callme_result").html("<div class='sending'>Отправка...</div>"); setTimeout( function(){ sendMail(); }, 2000); //setTimeout( function(){ jQuery(this).attr('disabled', ''); }, 5000); return false; }); }); |
Кто-нибудь мне поможет с данным вопросом! Надо всего лишь скрипт прикрепить к тесту "обратный звонок"!
|
petlyra5, оберни "Заказать обратный звонок" в span с каким-либо class-ом и пропиши таковой вместо .btn в
jQuery("#callmeform .btn").click(function(){ |
Цитата:
|
petlyra5,
<link rel="stylesheet" href="/callme/callme.css" type="text/css"> <script type="text/javascript" src="/callme/jquery.min.js"></script> <script type="text/javascript" src="/callme/jquery.storage.js"></script> <script type="text/javascript" src="/callme/callme.js"></script> <div id="callme"><input id="viewform" type="button"></div> <div id="callmeform" class="hide-off"><div id="cme_cls"></div><h6><font color="#03539C"><span class="btn1">Заказать обратный звонок</span></font></h6> <table cellpadding="0" cellspacing="0"> <tbody><tr><td>Ваше имя</td></tr> <tr><td><input class="txt" maxlength="150" id="cname" value="" type="text"></td></tr> <tr><td>Телефон</td></tr> <tr><td><input class="txt" maxlength="150" value="+7-" id="cphone" type="text"></td></tr> <tr><td>Вопрос или комментарий</td></tr> <tr><td><input class="txt" maxlength="1000" id="ccmnt" type="text"></td></tr> <tr><td> <!--<input class="btn" value="Перезвоните мне" type="button">--></td> </tr> </tbody></table> <div id="callme_result"></div> </div> jQuery(function(){ jQuery("#viewform").click(function(){ jQuery("#callmeform").fadeToggle("fast"); }); jQuery("#cme_cls").click(function(){ jQuery("#viewform").click(); }); jQuery("#viewform").hover( function () { jQuery(this).addClass("callmeform_hover"); }, function () { jQuery(this).removeClass("callmeform_hover"); } ); }); function sendMail() { var cnt = jQuery.Storage.get('callme-sent'); // getting last sent time from storage if (!cnt) { cnt = 0; } jQuery.getJSON("/callme/index.php", { cname: jQuery("#cname").val(), cphone: jQuery("#cphone").val(), ccmnt: jQuery("#ccmnt").val(), ctime: cnt, url: location.href }, function(data) { message = "<div class='" + data.cls + "'>" + data.message +"</div>"; jQuery("#callme_result").html(message); if (data.result == "success") { jQuery.Storage.set("callme-sent", data.time); jQuery("#callmeform .btn").attr("disabled", "disabled"); setTimeout( function(){ jQuery("#viewform").click(); }, 10000); setTimeout( function(){ jQuery("#callmeform .txt").val(""); }, 10000); } }); // } } jQuery(document).ready(function(){ jQuery("#callmeform .txt").focus(function(){ //jQuery(this).val(""); }); jQuery("#callmeform .btn1").click(function(){ jQuery("#callme_result").html("<div class='sending'>Отправка...</div>"); setTimeout( function(){ sendMail(); }, 2000); //setTimeout( function(){ jQuery(this).attr('disabled', ''); }, 5000); return false; }); }); |
lord2kim,
Может я не правильно разъяснил! Мне нужно текст"Заказать обратный звонок" на странице http://flir.su/test/ сделать так, чтобы после нажатия на текст всплывало окно, где заполняются данные! Такое же как при нажатии на вкладке справа "Заказать обратный звонок" А эту вкладку убрать совсем! Буду благодарен если поможете! Спасибо за старания! |
Часовой пояс GMT +3, время: 05:32. |
|