Event.observe(window,'load',function ()
{
$$('.overlabel').invoke('overlabel');
});
[Edit 20090223: Ajout exemple avec invoke]
Exemple: Lien "Développer / Réduire au titre sur la page" d'accueil.
$$('.snippet').invoke('toggle');
ou itération manuelle:
function toggle_snippets()
{
var f = $$('.post-content');
for(var i=0; i < f.length; i++) {
f[i].toggle();
}
}
<?php echo javascript_tag(" function add_bar(text, li) { var bar_id = li.id; $('bar').value = ''; var ajax_url= '". url_for('@member_add_bar_get'). "?bar_id=' + bar_id; new Ajax.Request(ajax_url, { onSuccess: function(transport) { $('member_myfavbarsbox_list').update(transport.responseText); } }); } ") ?> <?php echo input_auto_complete_tag('bar', '', array( 'module' => 'bar', 'action' => 'autoComplete', ), array( 'autocomplete' => 'off', 'size' => '50', 'indicator' => 'indicator', ), array( 'use_style' => true, 'frequency' => "0.2, paramName: 'string_start', afterUpdateElement: add_bar, method: 'get'", )); ?>
var Fruit = Class.create(); Fruit.prototype = { initialize: function(fruit){ this.fruit = fruit; }, toString: function(){ return 'I am a fruit and my name is "' + this.fruit + '".'; } } var apple = new Fruit('apple'); $('fruits').update(apple); $('fruits').innerHTML; // -> 'I am a fruit and my name is "apple".'
String.prototype.trim = function() { return this.replace(/(?:^\s+|\s+$)/g, ""); }
ou utiliser la fonction prototype
$F('dc_message_to_id').strip();
'onchange' => remote_function(array( 'update' => 'item_domain', 'url' => 'list/subdomain', 'with' => "'id=' + this.options[this.selectedIndex].value" ))
logs
8113.2 KB