fulinqingjie/resources/views/layouts/js.blade.php

66 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script src="{{asset('js/jquery.1.8.2.min.js')}}"></script>
<script src="{{asset('/web/js/public.js')}}"></script>
<script>
function addFavorite2() {
var url = window.location;
var title = document.title;
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("360se") > -1) {
alert("由于360浏览器功能限制请按 Ctrl+D 手动收藏!");
} else if (ua.indexOf("msie 8") > -1) {
window.external.AddToFavoritesBar(url, title); //IE8
} else if (document.all) {
try {
window.external.addFavorite(url, title);
} catch (e) {
alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
}
} else if (window.sidebar) {
window.sidebar.addPanel(title, url, "");
} else {
alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
}
}
function check(form) {
if (form.word.value == '') {
alert("请输入留言!");
return false;
}
if (form.name.value == '') {
alert("请输入姓名!");
return false;
}
if (form.email.value == '') {
alert("请输入邮箱!");
return false;
}
if (form.phone.value == '') {
alert("请输入电话!");
return false;
}
var isPhone = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
if(!isPhone.test(form.phone.value)){
alert("电话号码格式不正确");
return false;
}
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if(!reg.test(form.email.value)){
alert("邮箱格式不正确");
return false;
}
$.get("/",
{'username':form.name.value ,'word':form.word.value ,'phone':form.phone.value , 'email':form.email.value} ,
function(res){
if(res){
alert('留言成功');
} else{
alert('留言失败');
}
},'json'
);
}
// $(".btnSearch").click(function(){
// console.log($("#searchValue").val())
// $.ajax
// })
</script>