I can't find $get syntax information

J

John Kotuby

Hi all,
I was just looking at some example code in the VS2008 help for VB. In a
JavaScript example I came across some syntax that I didn't recognize and
could not find information about on the usual JS sites I use as resources.
In a place where I expected to see "document.getElementById('elementId')",
instead the Microsoft example use the syntax "$get('elementid')".

So I tried it in some of my code and it seems to work fine.

Can somebody explain this short-hand syntax to me or at least point to a
resource where I can read about it? It sure beats the heck out of typing
document.getElementById.

I just want to make sure I won't run into any compatibility problems if I
start using that syntax regularly.

Thanks in advance...
 
A

Anthony Jones

John Kotuby said:
Hi all,
I was just looking at some example code in the VS2008 help for VB. In a
JavaScript example I came across some syntax that I didn't recognize and
could not find information about on the usual JS sites I use as resources.
In a place where I expected to see "document.getElementById('elementId')",
instead the Microsoft example use the syntax "$get('elementid')".

So I tried it in some of my code and it seems to work fine.

Can somebody explain this short-hand syntax to me or at least point to a
resource where I can read about it? It sure beats the heck out of typing
document.getElementById.

I just want to make sure I won't run into any compatibility problems if I
start using that syntax regularly.


Something in the JS files included by MS adds this function:-

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

$get isn't defined by the script context.
 
L

Lloyd Sheen

John Kotuby said:
Hi all,
I was just looking at some example code in the VS2008 help for VB. In a
JavaScript example I came across some syntax that I didn't recognize and
could not find information about on the usual JS sites I use as resources.
In a place where I expected to see "document.getElementById('elementId')",
instead the Microsoft example use the syntax "$get('elementid')".

So I tried it in some of my code and it seems to work fine.

Can somebody explain this short-hand syntax to me or at least point to a
resource where I can read about it? It sure beats the heck out of typing
document.getElementById.

I just want to make sure I won't run into any compatibility problems if I
start using that syntax regularly.

Thanks in advance...


http://www.asp.net/AJAX/documentation/

LS
 
J

John Kotuby

Thank you Anthony,

That is VERY important to know.
I did not knowingly include any Microsoft JS files in my code.
When I look at the HTML source in the IE7 browser I can't find any function
declaration for $get() or a reference to the .js file.
But I have a bunch of 3rd party controls that that generate almost
unreadable JavaScript, so maybe I missed it.
I am now wondering if the IE browser simply interprets it correctly.

Have a good day.
 
J

John Kotuby

Thanks Lloyd,

When I typed in the search term $get in the native VS2008 help, I got
nothing even remotely related.
When I typed that same term into the searchbox on the page you provided, the
2nd article returned had exactly what I needed.

Many thanks...
 
G

George Ter-Saakov

I bet you are referencing the external JavaScript file

Just do not look for .js

Look for script tag.
You will find it in a form like this
<script src="/WebResource.axd?.....">

That is where $get is defined.

George.




John Kotuby said:
Thank you Anthony,

That is VERY important to know.
I did not knowingly include any Microsoft JS files in my code.
When I look at the HTML source in the IE7 browser I can't find any
function declaration for $get() or a reference to the .js file.
But I have a bunch of 3rd party controls that that generate almost
unreadable JavaScript, so maybe I missed it.
I am now wondering if the IE browser simply interprets it correctly.

Have a good day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top