b/S Road long Summary (ii)

Source: Internet
Author: User

Seven. Background how to get the address of the form, with what to get the value of the form submission


Response.Redirect (): Outputs a data to the client that tells the client to jump to the specified interface and the URL of the client browser changes. Changes to the specified page ***.aspx



Request.forward (): A forwarding within the server is implemented that does not change the address of the client browser.





viii. jquery value and assignment of basic controls


    • Textbox:


    • Lable:


    • Multiple marquee checkbox:


    • Radio Group Radio:
$ ("input[@type =radio]"). attr ("Checked", ' 2 '); Set the value=2 item as the currently selected item


    • Drop-down box select:
$ ("#select_id"). attr ("value", ' test ');//Set Value=test item as currently selected $ ("<option value= ' test ' >test</option> <option value= ' test2 ' >test2</option> '). AppendTo ("#select_id")//Add the drop-down box option $ ("#select_id"). empty (); Empty the drop-down box to get a set of radio values named (items) that are selected var item = $ (' input[@name =items][@checked] '). Val ();//If Unchecked, val () = undefined Take the text of select selected item var item = $ ("select[@name =items] option[@selected]"). Text (); The second element of the Select drop-down box is the currently selected value $ (' #select_id ') [0].selectedindex = 1; The second element of the radio Radio Group is the currently selected value $ (' input[@name =items] '). Get (1). checked = true;//Resets the form $ ("form"). each (function () {. reset ();});


Nine, several elements of the box model




10. Adding events dynamically in JS


    • SetAttribute
var obj = document.getElementById ("obj");
Obj.setattribute ("onclick", "Javascript:alert (' Test ');");


    • With Attachevent and AddEventListener.
IE support Attachevent
Obj.attachevent ("onclick", foo), function Foo () {    alert ("Test");}


Can also be written together
Obj.attachevent ("onclick", function () {alert ("Test");});


Other browsers support AddEventListener
Obj.addeventlistener ("Click", Foo, false), function Foo () {    alert ("Test");}


Can also be written together
Obj.addeventlistener ("click", Function () {alert ("Test");}, False);


    • Method Three:



To add the onclick event dynamically:


If you use anonymous function () {}, as shown below:
<input type= "button" value= "I am button" id= "Bu" > <script type= "Text/javascript" > var bobj= document.getElementById ("bu"); Bobj.onclick=function () {alert (this.value)}; </script>



11. The difference between div and span


The difference between SPAN and Div is that Div (division) is a block-level element that can contain paragraphs, headings, tables, and even chapters, summaries, and notes. While span is an inline element, span is not wrapped, it has no structural meaning, it is purely applied, and spans can be used when other inline elements are not appropriate.

The span tag has an important and useful feature, that is, it doesn't do anything, its sole purpose is to surround other elements in your HTML code so that you can assign styles to them.   In this example, the,<span> identifier allows you to divide a paragraph into different parts. There is also an identifier that has similar functionality, and <div>div is also used to create a logical part of the HTML file. But unlike <div>span,,<div> works at the block level of text, which introduces line separation before and after the HTML elements it contains.



12, handwritten a singleton mode


public class singleton{    private static Singleton _instance = null;    Private Singleton () {} public    static Singleton CreateInstance ()    {        if (_instance = = null)        {            _ Instance = new Singleton ();        }        return _instance;}    }



13. Xmlhttpruquest Object finally returns


In Ajax, xmlhttp.readystate refers to the XMLHTTP interaction State, Xmlhttp.status is a status code returned when XMLHTTP interacts with the background. Xmlhttp.readystate = = 4 indicates that Xmlhttp's interaction state is complete, Xmlhttp.status = = 200 indicates that the Xmlhttp interacts with the background normally. Here are some related references:


Status State value

Long plastic standard HTTP status code, defined as follows (common)  

OK success

Bad Request not found

Internal Server error Server parsing error


Status value of readystate:

0 (uninitialized) object has been established but not initialized (the open method has not been called)

1 (Initialize) object has been established, the Send method has not been called

2 (send data) The Send method has been called, but the current state and HTTP headers are unknown

3 (data transfer) received part of the data, because the response and HTTP header is not complete, then through the responsebody and responsetext to obtain some of the data will be error

4 (complete) The data is received, at which time the complete response data can be obtained by responsebody and ResponseText


14. The difference between get and post

1.get requests need to be aware of caching issues, post requests do not need to worry about this issue

2.post request must be set Content-type value to application/x-form-www-urlencoded

3. When sending a request, the Send function sends a NULL parameter because the GET request parameters are in the URL, and the POST request is given its arguments when using the Send method. Small amount of data sent using GET request, large amount of data sent by POST request


15, the application of jquery look again (very important)

There are a lot of wonderful tutorials in mu-net.


16, handwritten a Web page frame


b/S Road long Summary (ii)

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.