js/ajax跨越访问—jsonp的原理和实例(javascript和jquery)
摘要:很庆幸,我又见到了末日后新升的太阳,所以我还能在这里写文章,言归正传哈,最近做了一个项目,需要用子域名调用主域名下的一个现有的功能,于是想到了用jsonp来解决,在我们平常的项目中不乏有这种需求的朋友,于是记录下来以便以后查阅同时也希望能帮到大家。什么是JSONP协议?JSONP即JSON with Padding。由于同源策略的限制,XmlHttpRequest只允许请求当前源(域名、协议、端口)的资源。如果要进行跨域请求,我们可以通过使用html的script标记来进行跨域请求,并在响应中返回要执行的script代码,其中可以直接使用JSON传递javascript对象。这种跨域的通讯方式
阅读全文
posted @
2012-12-25 23:11
larryle
阅读(156)
推荐(0)
div弹出层居中
摘要:1 <!DOCTYPE HTML> 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <title>Js制作简单弹出层DIV在页面居中 中间显示 遮罩 方法</title> 5 <style type="text/css"> 6 *{margin:0;padding:0;} 7 #bt{border: 2px solid #000;backgroun
阅读全文
posted @
2012-12-12 21:40
larryle
阅读(1137)
推荐(0)
js刷新父页面
摘要://子窗口刷新父窗口 <script language=JavaScript> self.opener.location.reload(); </script> ( 或 <a href="javascript:opener.location.reload()">刷新</a> ) //如何刷新另一个框架的页面用 <script language=JavaScript> parent.另一FrameID.location.reload(); </script> 如果想关闭窗口时刷新或者想开窗时刷新的话,在&
阅读全文
posted @
2012-12-05 11:31
larryle
阅读(214)
推荐(0)
jqurey ui 弹出浮动层
摘要:<!-- query_ui--><link rel="stylesheet" type="text/css" href="../js/jquer_ui/css/ui-lightness/jquery-ui-1.8.19.custom.css"><script src="../js/jquer_ui/js/jquery-ui-1.8.19.custom.min.js"></script><!-- query_ui--------------------------
阅读全文
posted @
2012-04-26 18:55
larryle
阅读(263)
推荐(0)
jquery组织表单提交
摘要:$("form").submit(function () { if ($("#<%=txtJobDepartmentId.ClientID %>").val() == "-请选择-") { $("#checkdeptment").show(); return false; } else { $("#checkdeptment").hide(); } });
阅读全文
posted @
2012-01-06 18:07
larryle
阅读(243)
推荐(0)
jquery实现让所有的checkbox全选反选
摘要:<script src="../Js/jquery-1.6.4.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#all_check").click(function () { if ($("#all_check").attr("checked")) { $("#joblisttable"
阅读全文
posted @
2011-12-30 09:37
larryle
阅读(105)
推荐(0)
3秒钟自动条状到指定页面,以post方式向一个页码提交参数
摘要:<script> $(function () { $("#sub").click(function () { post('http://www.test23.com:81/login.aspx', { username: $("#username").val(), password: $("#pwd").val() }); }); }); function post(URL, PARAMS) { var temp = document.createElement("form"); tem
阅读全文
posted @
2011-12-21 17:21
larryle
阅读(184)
推荐(0)
jquery实现checkbox全选反选
摘要:<script type="text/javascript"> $(function () { $("#allcheck").click(function () { if ($("#allcheck").attr("checked")) { $("#jobtable").find(":checkbox").each(function () { if ($(this).attr("id") != "allcheck") $(t
阅读全文
posted @
2011-12-02 17:03
larryle
阅读(85)
推荐(0)
jquery基本知识大全
摘要:*********************************************************************************************************************************** each循环 *********************************************************************************************************************************** each用法 ***************...
阅读全文
posted @
2011-11-29 23:40
larryle
阅读(86)
推荐(0)
js新闻滚动和弹出div层效果
摘要:<style type="text/css"> #scroll { margin: 0; padding: 4px 0; list-style: none; width: 100%; height: 20px; overflow: hidden; } #scroll li { margin: 0; padding: 0 4px; font-size: 12px; height: 20px; line-height: 20px; } .black_overlay { display: none; position: absolute; top: 0%; left:
阅读全文
posted @
2011-11-25 12:57
larryle
阅读(140)
推荐(0)
jquery基本知识
摘要:Each循环----------------------------------------------------------------------------------------------------------------------------------------------------------------------each用法--------------------------------------------------------------------------------------------------------------------------
阅读全文
posted @
2011-11-24 23:22
larryle
阅读(67)
推荐(0)