473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

shorten a method string

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

Jan 31 '06 #1
3 1664
neoswf wrote on 31 jan 2006 in comp.lang.javascript:
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?


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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 31 '06 #2
Evertjan. wrote:
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...

Jan 31 '06 #3
neoswf wrote:
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>

:)

Jan 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Mike MacSween | last post by:
Some of my users are getting 'Disk or Network Errors'. I've raised it with the network admins, they're looking into it. In the meantime... My 'standard' error handlers logs errors to a table...
24
by: John Smith | last post by:
I want to shorten a string by replacing the last character by '\0'. The following code displays the string. It works fine. It's in a loop and different strings are displayed without problems....
1
by: Kenneth Keeley | last post by:
Hi, I am creating a news and events page for my web site and I have a data grid for the summary of news items that is using a TemplateColumn I can layout the data in the format I wish. My only...
3
by: UKuser | last post by:
Hi, Is there a way to shorten this line if ((ereg(".jpg",$filename))||(ereg(".eps",$filename))||(ereg(".tif", $filename))||(ereg(".tiff",$filename))||(ereg(".jpeg",$filename))||...
5
by: Dean | last post by:
Hi, I have a table with non-unique identifiers. I need to take all the values with the same ID's and combine them into one field with a semicolon as a seperator. These values may exceed 255...
3
by: moomooboy | last post by:
guys please help me T_T im currently stuck on string, it takes too many line. here is my sample: char breadmenu; strcpy (breadmenu,"Parmasan"); strcpy (breadmenu,"Gralic"); strcpy...
1
by: treeguy | last post by:
I am not a developer but my site has long URL strings that have problem getting crawled. I understand Google now will crawl past the + but does not like the long strings. I tried URL rewrite and it...
7
by: K Viltersten | last post by:
I'm using the code below. I know for sure that the data obtained will be a single value. Hence, it feels somewhat like nuking a fly to use the adapter etc. Is it possible to shorten the code for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.