« Home « Chủ đề lập trình website

Chủ đề : lập trình website


Có 60+ tài liệu thuộc chủ đề "lập trình website"

Practical prototype and scipt.aculo.us part 38

tailieu.vn

Figure 10-1. Here, we’re changing the element’s left and top properties from 0px to 50px . When we set the new style, it happens instantaneously—the box jumps down to its new place, as in Figure 10-2.. Figure 10-2. Unfortunately, when we run this code, we find that it behaves exactly the same way as the first example—the box seems to...

Practical prototype and scipt.aculo.us part 39

tailieu.vn

new Effect.Morph('box',. Effect.Morph is smart enough to figure out how to get from A to B.. Perhaps the best thing about Effect.Morph is its ability to animate several different things at once. Effect.Morph handles it with aplomb (see Figure 10-6).. Effect.Morph can animate any number of CSS properties at once.. There’s no way to animate the switch from uppercase to...

Practical prototype and scipt.aculo.us part 40

tailieu.vn

Figure 10-8. Effect.Move animates an element’s position.. Effect.Scale. Effect.Scale handles, well, scaling—changing the size of an element (and, optionally, the size of its contents) by a given percentage (see Figure 10-9):. new Effect.Scale('box', 150);. Figure 10-9. Effect.Scale animates an element’s height and width.. (Note that the contents of the box have been scaled as well—the text is also 150 percent...

Practical prototype and scipt.aculo.us part 41

tailieu.vn

Effect.ScrollTo. Effect.ScrollTo is far more focused than the other core effects. It animates the scrolling of the browser viewport to bring the specified element into view. In other words, it’s a time-lapse version of Prototype’s Element#scrollTo function.. Let’s also change the height of the page so that we’ll have some space below the box:. JS: */new Effect.ScrollTo('box');. It helps the...

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...

Java Programming for absolute beginner- P1

tailieu.vn

JavaProgAbsBeg-00Fnt.qxd AM Page i. To check for updates or corrections relevant to this book and/or CD-ROM visit our updates page on the Web at http://www.prima-tech.com/support.. To comment on this book or any other PRIMA TECH title, visit our reader response page on the Web at http://www.prima-tech.com/comments.. For individual orders, turn to the back of this book for more information.. JavaProgAbsBeg-00Fnt.qxd...

Java Programming for absolute beginner- P2

tailieu.vn

The examples are fun to program, and at the same time, demonstrate important programming skills that you can use to write different types of programs.. I do not assume that you have any programming experience. If you do have some programming experience, but have little to no experience with Java, you will also benefit from reading this book and learning...