Show and hide div - Prototype with XhochY modification

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_filter_texy_fshl_highlighter' was given in /var/www/vhosts/private/zalewa/piotr/drupal/modules/texy/texy/modules/tm-block.php on line 192.

The goal is to look if the modified Prototype actually works. Let's make an object hide and show on user action.

hide

this is a test object which should hide and show on user action

I created an action link and object on which action will be taken. I gave them ids test_hide and test_hide_button

Prototype accesses the DOM elements using $(id_name) function. Because it is a modification, I have to use $ID(id_name).

Example uses hide() and show() Prototype functions.

<a id='test_hide_button' onclick="showhide('test_hide')">hide</a>
<p id='test_hide'>this is a test object which should hide and show on user action</p>

<script type='text/javascript'>
function showhide( id ) {
  if ($ID(id).hidden) {
    $ID(id).show();
    $ID(id).hidden = false;
    $ID(id + '_button').innerHTML = 'hide';
  } else {
    $ID(id).hide();
    $ID(id).hidden = true;
    $ID(id + '_button').innerHTML = 'show';
  }
}
</script>

Trackback URL for this post:

http://piotr.zalewa.info/trackback/8

Comments

casquette prada (not verified) 1970, January 1 - 00:00

dear friend,and i think it is very good information.thank you very much.

Research paper help (not verified) 1970, January 1 - 00:00

Thanks for a good script. It really works.

Torrents (not verified) 1970, January 1 - 00:00

So what is best? Follow this script or totally replace drupal's jQuery with Prototype as you people say?? Can i have some help ??

torrents software (not verified) 1970, January 1 - 00:00

Its a good script but i am really thinking of fully replace drupal's jQuery into Prototype. Thanks.

network virtualization (not verified) 1970, January 1 - 00:00

The modification you have detailed here is really a simple one. You this helps server and hosting packager for you site and other related server too. I am searching similar coding to make user comfort too. It will be more effective if different hosting package are served from same data base as per Google do.

Philippine jewelry (not verified) 1970, January 1 - 00:00

Thanks for sharing this information.

Fenopy (not verified) 1970, January 1 - 00:00

Its a good script and congrats to you that you have figured it out.

clothing factory (not verified) 1970, January 1 - 00:00

But I am really thinking of fully replace drupal's jQuery into Prototype. Haven't found anything like this for the moment.

eztv (not verified) 1970, January 1 - 00:00

Thanks what about time delay?

Piotr 1970, January 1 - 00:00

Will do, But I am really thinking of fully replace drupal's jQuery into Prototype. Haven't found anything like this for the moment.

Prem (not verified) 1970, January 1 - 00:00

Thanks for this! I used it with some modifications and it worked well!

Keep posting more of such code!

Thanks! Prem

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.