We help IT Professionals succeed at work.
Get Started

Basic Javascript Syntax

NTGuru705
NTGuru705 asked
on
418 Views
Last Modified: 2010-08-05
Lets talk Javascript... I am a MS freak and I dont know anything about Javascript.  But I have to write some code in javascript...my problem is not with concept but with syntax... I will post a few questions here and hopefully you guys can point me in the right direction...

1. In vbscript you say:
If MyVar IS NOT NOTHING
'DO SOMETHING
How do you say in js?

2. In vbscript you say:
for(i=0 to MyArray.Length)
'DO SOMETHING
Next
How do you say in js?

3. In vbscript you say:
for each value in MyValues
MsgBox(value.Property)
next
How do you say in js?

4. When working with ActiveXObject() what needs to be declared and what does not.  If the object returns a different object in vbscript you can just say this...
Set HTTP = CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =CreateObject("MSXML.DOMDocument")
xmlDOC.Async=False
Dim MYURL
HTTP.Open "GET",URL, False
HTTP.Send()
bOK = xmlDOC.load(HTTP.responseXML)
if Not bOK then
      Set GetXMLDOC = nothing
Else
      Set GetXMLDOC = HTTP.responseXML
end If

In the above example GetXMLDOC  will be the return from that method... so if this were a funtion the caller would then be able to make use of that value... hwo to use in javascript though?

Thanks for your help...
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE