Jump to content


Photo
- - - - -

getElementById mootools/prototype style


  • Please log in to reply
5 replies to this topic

#1 curthard89

curthard89

    Young Padawan

  • Members
  • Pip
  • 226 posts

Posted 05 December 2007 - 08:08 AM

Ok, i dont need help...but instead of typing document.getElementById blablabla al lthe time, just shorten it by creating a simple function which looks like:

function $(id){
return document.getElementById(id);
}

and thats it, so instead of
document.getElementById('myidhere').style.display="none";
u can do
$('mydivhere').style.display="none";

simple, and saves time, aswell as looking better

:)

#2 Wildhoney

Wildhoney

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 05 December 2007 - 07:36 PM

Prototype is a life saver, isn't it! I use that short-hand version all the time, in fact there's so many short-handed ways to do various tasks in Prototype I forget half of them!

Edited by Wildhoney, 05 December 2007 - 07:36 PM.


#3 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 05 December 2007 - 08:43 PM

So what is it that you need help with? This sounds more like a tutorial than a question to me.

#4 curthard89

curthard89

    Young Padawan

  • Members
  • Pip
  • 226 posts

Posted 06 December 2007 - 02:34 PM

i dont need help, i said that, no where else to put it :o

#5 shameless_w_o_a_d

shameless_w_o_a_d

    Young Padawan

  • Members
  • Pip
  • 42 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:Web Design, Graphics Design, Computers, Games, Music, Basketball

Posted 06 December 2007 - 07:41 PM

I believe you could've listed this under the Miscellaneous Tutorials in the Tutorial Free-For-All section.

Still, it's a handy function and I use Prototype as well, so for those who want the simplicity of writing that without the need to use the entire library, this is the answer to their prayers. :o

#6 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 06 December 2007 - 08:16 PM

i dont need help, i said that, no where else to put it :)

Damn my short-term memory!

I believe you could've listed this under the Miscellaneous Tutorials in the Tutorial Free-For-All section.

:winner:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users