« Home « Chủ đề các bước cơ bản khi lập trình

Chủ đề : các bước cơ bản khi lập trình


Có 54+ tài liệu thuộc chủ đề "các bước cơ bản khi lập trình"

Practical prototype and scipt.aculo.us part 42

tailieu.vn

beforeSetup and afterSetup are called before and after the “setup” stage of an effect—in which the effect makes any necessary modifications to the element itself.. Effect.Fade('box',. Effect.Base class (from which all effects derive) defines some instance properties, you’re able to use these same properties in your callbacks:. effect.element.remove();. You may also use several other properties: options to access the effect’s...

Practical prototype and scipt.aculo.us part 43

tailieu.vn

<tr class="RB1">. <td class="pos">RB</td>. <td>James Madison</td>. <td class="summary"></td>. <td class="score">0</td>. <tr class="RB2">. <td>John Jay</td>. <tr class="WR1">. <td class="pos">WR</td>. <td>John Marshall</td>. <tr class="WR2">. <td>Daniel Webster</td>. <tr class="TE">. <td class="pos">TE</td>. <td>Samuel Chase</td>. We’ll place two such tables into our page—one for each team.. charset=utf-8">. <script src="js/prototype.js". type="text/javascript"></script>. <script src="js/scriptaculous.js". Now we’re going to search back through the examples from earlier chapters. We’ll...

Practical prototype and scipt.aculo.us part 44

tailieu.vn

For this, we’ll need to add some logic to our updateTeam function:. charset="utf-8">. We’re done! Reload the page and congratulate yourself for doing something awe- some. We’ve spent quite a few pages on effects for good reason: they’re the meat and potatoes of script.aculo.us, and the only piece that’s a dependency for all the rest. The script.aculo.us UI widgets all...

Practical prototype and scipt.aculo.us part 45

tailieu.vn

The Draggable constructor (the initialize method that gets called when you instantiate a class) takes care of assigning the events that control drag- ging. So let’s add some options. Play around with the draggables and you’ll notice the difference: they now move back (or revert) to their original positions at the end of the drag.. Another option controls how much...

Practical prototype and scipt.aculo.us part 46

tailieu.vn

Figure 11-3. As a developer, you might expect a drop to correspond with a move- ment in the DOM. The act of dragging an li over a ul feels like it ought to detach that li from its current parent and attach it to the new ul . Figure 11-4. Firebug confirms that the drag-and-drop action did not change the...

Practical prototype and scipt.aculo.us part 47

tailieu.vn

<script type="text/javascript">. <ul id="container">. id="item_1">Lorem</li>. id="item_2">Ipsum</li>. id="item_3">Dolor</li>. id="item_4">Sit</li>. id="item_5">Amet</li>. when a dragged element gets near a new “slot,” the elements on either side part to give it room. The following subsections describe some of the other options you might use with sortables.. If an array is given, sortables will be allowed to be dragged outside of their parent, and can...

Practical prototype and scipt.aculo.us part 48

tailieu.vn

One, named Autocompleter.Local , keeps an array of possible suggestions for instantaneous feedback. The other, Ajax.Autocompleter , relies on a remote server to give it suggestions—making an Ajax call whenever suggestions need to be retrieved.. Naturally, Autocompleter.Local has less overhead, since it does not need to talk to the server. You’ll only want to fall back to Ajax.Autocompleter if the...

Practical prototype and scipt.aculo.us part 49

tailieu.vn

Now we’ll add the JavaScript that sets up the autocompleter on page load. The syn- tax for Ajax.Autocompleter is identical to that of Autocompleter.Local , except for the third argument:. new Ajax.Autocompleter(inputElement, updateElement, url, options);. We can give a simple rela- tive URL, since index.html and autocomplete_players.php are in the same directory:. new Ajax.Autocompleter('player_name', 'player_suggestions', 'autocomplete_players.php');. Click the text box,...

Practical prototype and scipt.aculo.us part 50

tailieu.vn

(With the Firebug pane visible, click Inspect, and then click in the text box.) The HTML inspector shows us that the input element has a class name of editor_field , and that its form parent node has an ID of team_name-inplaceeditor (in other words, it adds -inplaceeditor to the ID of the original element.. Here are some of the most...

Practical prototype and scipt.aculo.us part 51

tailieu.vn

In this chapter, we’ll look at some of these tactics and patterns. We’ll move beyond an explanation of what the framework does and into higher-level strategies for solving problems. They’re more like recipes. Prototype uses one mixin that you’ll recognize instantly: Enumerable . We can pass them to Class.create . The arguments we give to Class.create are sim- ply groups...

Practical prototype and scipt.aculo.us part 52

tailieu.vn

var someInstance = Widget.Foo.instances[someElement.id];. To ensure that the element has an ID, we can use Element#identify . The method returns the element’s ID if it already exists. What if we don’t know the name of the class? In order to move this code into a mixin, we’ll have to remove any explicit references to the class’s name. Luckily, we’ve already...

Practical prototype and scipt.aculo.us part 53

tailieu.vn

So we must search the browser’s user-agent string to see whether it uses the affected engine—then we must look at the release year of the engine to figure out whether it’s old enough to be affected.. And the quirks you’ll encounter probably won’t be so tenacious. But eventually, if you write enough code, you’ll need to do some occasional browser...

Practical prototype and scipt.aculo.us part 54

tailieu.vn

addClassName method, 117–119 addMethods method, 148 addObservers function, 102, 105 administration section, 288. advanced enumeration, 38–40 Enumerable#inject method, 38–39 Enumerable#invoke method, 40 Enumerable#map method, 38–39 Enumerable#pluck method, 40 after value, 59. styling, 291–292 ajax.js file, 50. advanced enumeration, 38–40 Enumerable#inject method, 38–39 Enumerable#invoke method, 40 Enumerable#map method, 38–39 Enumerable#pluck method, 40 enumerable methods, 34–36. combination effects Effect.BlindUp and Effect.BlindDown,. 238–239....

Practical prototype and scipt.aculo.us part 55

tailieu.vn

Object.prototype, 42–44 Hash constructor, 43 Hash object, 43 Hash#get method, 43 Hash#set method, 43 Hash#update method, 43 header cell, 156. functions, 7–8 overview, 4 prototypes, 5–6 OOP, 139–158. serializing with Object.toJSON, 181–182 unserializing with String#evalJSON,. insert method, 120–125 readAttribute method, 126–127 remove method, 120–125. removeClassName method, 117–119 replace method, 120–123. toggleClassName method, 117–119 update method, 120–122. visible method, 115–117 writeAttribute...