Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / January 2006



Tip: Looking for answers? Try searching our database.

shorten a method string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
neoswf - 31 Jan 2006 11:58 GMT
hi. i want to shorten getElementById() string at my files.
ive writen this function:
function gebi(el){
    document.getElementById(el)
}
and when i try to call an ID, i try to call him like this:
gebi('myID').
but this method doesnt succeed.
can you please assist me to achive that goal?

tnx
NeoSwf
Evertjan. - 31 Jan 2006 12:11 GMT
neoswf wrote on 31 jan 2006 in comp.lang.javascript:

> hi. i want to shorten getElementById() string at my files.
> ive writen this function:
[quoted text clipped - 5 lines]
> but this method doesnt succeed.
> can you please assist me to achive that goal?

function gebi(el){
    return document.getElementById(el);
}

Signature

Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

neoswf - 31 Jan 2006 12:18 GMT
> function gebi(el){
>      return document.getElementById(el);
> }

thank you Evertjan.
how can i recive this kind of result:
gebi(el).style.width?
to use this method in different usages like reciving the style object
and etc...
neoswf - 31 Jan 2006 12:22 GMT
> to use this method in different usages like reciving the style object
> and etc...

thank you Evertjan, its working great!

<script>
    alert(gebi('shlomi').style.width);
</script>

:)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.