Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

defining object in javascript


  • Please log in to reply

#1
ggordie

ggordie

    Member

  • Member
  • PipPip
  • 40 posts
i'm trying to script a greeting that will execute on my computer on startup. the problem is, i dont know what object to use, because i'm not linking the js file to an html file, i'm executing it just as a js file because i dont a window opening as well as a popup.

here's my code:

document.alert("welcome gordie")

when i try to execute it i get a pop up saying:

script:          c:\documents and settings\ ... \startup\welcome.js
line:              2
char:            1
error:            'document' is undefined
code:            800A1391
source:          microsoft jscript runtime error


thanks alot!
  • 0

Advertisements


#2
timinator

timinator

    Member

  • Member
  • PipPip
  • 18 posts
The .js file is being executed by the Windows Script Host, not a a browser,
so there is no document object. Take a look at Microsoft's scripting site for further info: http://msdn.microsof.../scriptinga.asp

As a quick tip to get you started, what you want instead is this:
WScript.Echo("welcome gordie")
  • 0

#3
ggordie

ggordie

    Member

  • Topic Starter
  • Member
  • PipPip
  • 40 posts
thankl you, i'll read up. the only reason i was using an alert was for experament purposes, not because that's what i wanted, what i want is going to be alot more complex. it's going to determine the time and greet me acccordingly, with prerecorded greetings.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP