Ajax For Dumies phần 3

Tham khảo tài liệu 'ajax for dumies phần 3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 2 It s All About JavaScript 47 Using Ajax is all about inserting fresh data into a page without having to reload that page and using the Dynamic HTML DHTML technique of inserting text into a div or a span is very popular. Want to display some new data Fetch it from the server pop it into a div and pow there you are. The div element is the most popular but don t forget that it s a block element and so takes up its own line s in the browser. If you want to place new text inline consider span . Before you start sticking new text into a Web page left and right by using div and even more when you use span you have to consider how well the user is going to realize you ve changed things. That s one of the Ajax topics and criticisms of Ajax I discuss in Chapter 4 that the user might not realize that anything s changed. Because you have Dynamic HTML techniques such as popping text into div and span elements the whole page won t change just the element you re working with. Did the users notice Should you bring the change to their attention This is one of the elements of Ajax style coming up in Chapter 4. So far so good. But there s more to this story of using JavaScript functions. The and examples just passed a single argument to the displayText function but you aren t limited to that you can pass multiple arguments to a function just as easily. Passing multiple arguments To see how you pass multiple arguments take a look at the usearguments. html example in the code available for download from the Web site associated with this book. The inline Javascript code in this example passes not only the text to display but also the name of the div to insert text into html head title Passing multiple arguments to a function title script language javascriptTT function displayText text divName divName .innerHTML text script head body onload displayText You re using JavaScript targetDiv h1 Passing multiple arguments to a function

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.