随笔分类 - jQuery
摘要:过程不多说,直接上代码<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script><script type="text/javascript">var iframe_id_publish = 'works-publish-iframe';jQuery(function(){ jQuery('.works-publish-form').submit(function(){ var $_this
阅读全文
摘要:情景:域名A:http://www.sharefamily.net域名B:http://member.sharefamily.net域名A要通过ajax,调用域名B的数据,这样就会出现ajax跨域名请求的问题。如果你是使用了jQuery,那么就很好处理了,将ajax的dataType设置为jsonp就可以了。域名A的js代码原来是: jQuery.ajax({ url: 'http://member.sharefamily.net', type: 'get', dataType: 'json', success: function (rs) {
阅读全文
摘要:其实网上有很多教程的,不过他们基本只是提供如下代码: /***/$('.public-leftimg').each(function(){varx=100;//填入目标图片宽度vary=100;//填入目标图片高度varw=$(this).width();varh=$(this).height();//获取图片宽度、高度if(w>x){//图片宽度大于目标宽度时varw_original=w,h_original=h;h=h*(x/w);//根据目标宽度按比例算出高度w=x;//宽度等于预定宽度if(h<y){//如果按比例缩小后的高度小于预定高度时w=w_orig
阅读全文
摘要:原文地址:http://www.dotblogs.com.tw/cross/archive/2010/09/21/17840.aspxgoogle了很久,基本上都是用 activeX 来实现~至于为什么不行,这个不多说,说一下以下方法:已经测试通过的浏览器:IE6+,firefox,chrome,其中 firefox 和 chrome 要能支持 HTML5。<html><head><metahttp-equiv="Content-Type"content="text/html;charset=big5"><tit
阅读全文
摘要:这里作个记录平时使用的经验:/*************************************假设正确的返回值格式为:{"state":1,"msg":"return_message"}*************************************/$.ajax({'type':'POST','dataType':'json',//注意这里使用了json'url':'http://www.test.com/','
阅读全文
摘要:平时我们做开发的时候pasting,经常需要调试。比如说在PHP里面,想输出一个object,只需要<?phpecho'<pre>';print_r($object);echo'</pre>';?>在javascript,我们一般都是用 alert(object) 来做调试的,但是这样是调试不到object的,比如,varobject={'test_1','test_2','test_3'}如果用alert(object);得到的结果是 object object还有,借助goo
阅读全文
摘要:<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
阅读全文
摘要:页面代码如下: -- As the code below代码在 IE6下,当输入文字,然后回车,会出现浏览器关掉的问题。Under IE6, aftering inserted the words, and then press the enter, then the browser will close selftly.现在找到的解决办法, 如下面javascript里面红色加粗。Now the...
阅读全文
摘要:代码
阅读全文
摘要:<form action="" method="POST" id="form1"><input type="text" name="te" /><a href="" onclick="form_submit" >submit</a></form><script type="text/javascript">function f...
阅读全文
摘要:网页代码<form class="form2"><span class="left"> <b>one</b><br /><select size="8" id="select_1" name="select_1[]" multiple="multiple"><option value="1">niaoren_1&...
阅读全文
摘要:HTML代码:<span class="left"><b>one</b><ul id="list1" style="background-color:#ffee00" name="offJob"><li>1</li><li>2</li><li>3</li><li>4&...
阅读全文
摘要:假设table的id为tableContent$(document).ready(function(){$("#tableContent tr:even").addClass("evenClass");$("#tableContent tr:odd").addClass("oddClass");});
阅读全文
摘要:假设表单的id为"myForm",代码如下:$("#myForm")[0].reset();
阅读全文