jquery question and answer knowledge collation _jquery

Source: Internet
Author: User
Tags file upload file upload progress bar html header wrapper
Get ID: $ (this). attr ("id");
: Not usage
1. List usage
Copy Code code as follows:

var notlist = [];
Notlist.push ("#<%=txtsuggest.clientid%>");
var textelements = $ ("Input[type=text]:not (" + notlist +) ");
var firstfocusitem = null;
Traversing the elements of Type=text
Textelements.each (function (i) {
Todo
});

2. Exclusive usage
Copy Code code as follows:

$ ("Table[id^=tb]:not ([Id=tbbasicinfo])"). each (function () {
Alert ($ (this). attr ("id"));
});

If you do not add [], $ ("Table[id^=tb]:not (Tbbasicinfo)"), this is not possible
At this point, not is based on the former ID^=TB TB: not operation
Restore Background-color to the original color
Background-color:transparent
Remove the underline of href, the style that has been visited
A, a:visited{Text-decoration:none;}
Remove the point style of Li
li{margin:0; padding:0; List-sytle:none}
Gets a style in the current object's style
$ ("#divDept"). CSS ("display")
CSS BackGround URLs are not displayed
Because IE browser and FF for the processing path there are some differences, under IE Modify the BOXY.CSS code as follows.
Copy Code code as follows:

. boxy-wrapper. Top-left {background:url (' images/boxy-nw.png ');}
. boxy-wrapper. top-right {background:url (' images/boxy-ne.png ');}
. boxy-wrapper. bottom-right {background:url (' images/boxy-se.png ');}
. boxy-wrapper. Bottom-left {background:url (' images/boxy-sw.png ');}
/* ie6+7 hacks for the border. IE7 should support this natively but fails in conjuction with modal BG. * *
/* Nb:these must be absolute paths or URL to your images * *
. boxy-wrapper. top-left {#background: none; #filter:p Rogid:DXImageTransform.Microsoft.AlphaImageLoader (src= ' images /boxy-nw.png '); }
. boxy-wrapper. top-right {#background: none; #filter:p Rogid:DXImageTransform.Microsoft.AlphaImageLoader (src= ' Images/boxy-ne.png '); }
. boxy-wrapper. bottom-right {#background: none; #filter:p Rogid:DXImageTransform.Microsoft.AlphaImageLoader (src= ' Images/boxy-se.png '); }
. boxy-wrapper. bottom-left {#background: none; #filter:p Rogid:DXImageTransform.Microsoft.AlphaImageLoader (src= ' Images/boxy-sw.png '); }

This will be able to display under IE normal.
Get Table Object
$ ("Table[id=tableid]") or $ ("#tableID") Countdown usage
Copy Code code as follows:

$.getjson (

Loginserviceurl,{method: "Logout"},

function (Result) {

if (result. URL!= null) {

$ ("#transfer"). Countdown ({
Until: "+5s",
Expiryurl:result. Url
Ontick:function (periods) {
$ (this). Text (periods[6]);
}
});
}
});

There is a problem with the text () value in Google Chrome (), Val ()
The question of maximizing windows in Google Chrome
The following JS code is not a problem in Ff,ie
Copy Code code as follows:

if (Window.screen) {
var myw = screen.availwidth;
var myh = screen.availheight;
Window.resizeto (400, 400);
Window.moveto (0, 0);
}

    • resizeto,resize in Chrome has no effect.

Issue 2091: Window.resizeto () doesn ' t have any effect

    • By Design we don ' t support resize/move for tabs, only constrained windows.

Http://www.cnblogs.com/lonz/articles/381022.html

    • JavaScript Resizeto Bugs

http://code.google.com/p/chromium/issues/detail?id=11523

    • in Google Chrome/safari the textbox is free to lengthen by default, and why control does not allow it to lengthen freely.


Solution:

CSS to disable resizing

textarea {
resize:none;
}
name= "foo" > textarea[name=foo] {resize:none;} HTML is <textarea id= "foo" >) #foo {resize:none;}   

    • JS Compression Tool

Http://www.brainjar.com/js/crunch/demo.html

Disadvantages:

will be similar to the regular expression * * * removal

Sample:

Value = S.replace (/^0*/, ' ");

After Compress:

Value = S.replace (/^0, ' ");

    • What is the difference between parseint () and number () two functions?

Http://hi.baidu.com/iloverobot/blog/item/bd3ed651ffd362868c5430bf.html

    • JSON Problem

Http://blog.csdn.net/chinaontology/archive/2007/12/30/2004871.aspx

    • CSS Bottom Tip box

    • large File Upload progress bar display (imitation csdn resource upload effect)

Http://www.cnblogs.com/zengxiangzhan/archive/2010/01/14/1647866.html

    • Editable Input

http://acme.com/javascript/

    • jquery Set HTML header information

http://home.phpchina.com/space.php?uid=155537&do=blog&id=182698

    • a solution to the conflict between jquery and prototype (Ajaxpro)

Http://www.cnblogs.com/sxlfybb/archive/2009/06/04/1495995.html

    • using jquery + Handler (ashx) + LINQ to actually autocomplete

Http://www.dotblogs.com.tw/puma/archive/2009/03/10/7426.aspx

    • jquery Ajax Chinese garbled

http://phpxiaoxin.javaeye.com/blog/350544

    • reason analysis and solution of Ajax Chinese garbled

Http://hi.baidu.com/sihillver/blog/item/4d6f32f592920325bc3109d7.html

    • Create a high performance TreeView based on jquery

http://kb.cnblogs.com/page/50337/

http://kb.cnblogs.com/page/53517/

    • using jquery to achieve simpler Ajax Cross-domain requests

http://kb.cnblogs.com/page/53433/

    • Jquery.ajax Read XML
It 'i '  
Page (http://www.  Google. com/ig/API?  weather=buenos%         
doesn '
It Works Perfectly...I  dont  know  what  am  i  doing  wrong  i  let  u  the  code Span>that  i '  m  using  maybe  u  could  help  me  function  Clima () { $.  Ajax ( {type: ' Get ', url: ' Http://www.google.com/ig/api?weather=Buenos%20Aires ', DataType: ' xml ', success: function (data) {var $weather = $ (data). Find (' current_conditions ') console.log ($weather);});  function  Clima () {$.  Ajax ( {type: "Get", DataType: "xml", url: ' Http://www.google.com/ig/api?weather=Buenos%20Aires ', success: function (XML) {var weather = $ (XML). Find ("Current_conditions"). Find ("Temp_c"). attr ("Data");  alert ( "Prognostico para hoy:" + weather + "Grados");});        

    • fullsize: A new img tag attribute (with jquery implementation)

http://css9.net/img-fullsize/

Http://css9.net/wp-content/uploads/2009/04/fullsize/example.html

questions about $.ajaxsetup and $.get

Using in Common.js

  $.ajaxsetup ({
    URL: "...",
    type: "true, DataType:"function (arealist) {...}});  

Introducing Common.js on the PageA page

Then use the $.get (URL) in the script segment;

The URL here calls an ASPX page, and the result is no data loading! (Normal: There is data loading.) )

The trace error is then followed by the developer tool using IE8. Finally found cause error message (as follows)

"Invalid JSON: <form name=" Form1 " method=" post " action=" Ajax_select

So how to solve it?

Reason:

There must be a problem with the request data type?

Solution:

1. Page A pages script segment $.get (URL, "HTML");

Because the data in $.get is optional, now that we've identified the cause, we're going to make a reservation datatype

Result: OK

Analysis Source by:

is because the $.ajaxsetup is set with the global, so the global has set the Datatype:json.

the $.get () of page a pages is definitely affected.

Final Solution:

Change Common.js, remove Ajaxsetup global setting

$.ajax ({url: "...", type: "POST", Cache: true, DataType: "json", data: {Citycode:citycode, Flag:flag}, Success: function (arealist) {...}});

Result: OK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.