* FAQ    * Search  * Register * Login 
Active topics
Unanswered topics

All times are UTC-06:00



Post new topic  Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Need help with a Java script question.
PostPosted: Wed Nov 16, 2005 3:59 pm 
Offline
DBB Fleet Admiral
DBB Fleet Admiral
User avatar

Joined: Tue Feb 01, 2000 6:00 am
Posts: 2155
I've decided to take a Java Script course online, and for while I've had no trouble learning the codes and answering the question. But I don't seem to understand the answer to this question. Maybe I'm over analyzing it to much. Please help me out.


As written in the book.

What does the following script do?


If(Day==â?


Top
   
 Post subject:
PostPosted: Wed Nov 16, 2005 9:59 pm 
Offline
DBB Alumni
DBB Alumni
User avatar

Joined: Wed Mar 15, 2000 3:01 am
Posts: 8826
Location: Seattle
Is that all the code that's provided?

If so, it will be a lot easier if you look at the code formatted sanely:

Code:
if(Day == "Friday")
{
  document.write("T.G.I.F!");
}
else
{
  if(Day == "Monday")
  {
    document.write("Another Manic Monday!");
  }
  else
  {
    document.write("Good morning");
  }
}


You need to understand if statements.

if(expression)
{
// the code inside this block is executed
// if expression evaluates to true.
}
else
{
// the code inside this block is executed
// if expression evaluates to false.
}

So that code snippet works as follows.

Is the variable Day equivalent to the string expression "Friday"?
- If so, then call the write method on the document object with the argument "T.G.I.F."
- If not, then do the following:
-- Is the variable Day equivalent to the string expression "Monday"?
--- If so, then call the write method on the document object with the argument "Another Manic Monday!"
--- If not, then call the write method on the document object with the argument "Good morning"


Top
   
 Post subject:
PostPosted: Thu Nov 17, 2005 1:03 am 
Offline
DBB DemiGod
DBB DemiGod
User avatar

Joined: Sat Oct 24, 1998 2:01 am
Posts: 6415
Location: Calgary Alberta Canada
can javascript access the header request for a page?


Top
   
 Post subject:
PostPosted: Thu Nov 17, 2005 10:12 pm 
Offline
DBB Ace
DBB Ace
User avatar

Joined: Wed Jun 20, 2001 2:01 am
Posts: 347
Website: http://mypornaddiction.com/
Location: Orange County, CA, USA
throws exception cause 'Day' is not defined.


Top
   
 Post subject:
PostPosted: Thu Nov 17, 2005 10:23 pm 
Offline
DBB Fleet Admiral
DBB Fleet Admiral
User avatar

Joined: Tue Feb 01, 2000 6:00 am
Posts: 2155
Sorry for the late reply. But this backwards JavaScript bullshit is drives me up the wall sometimes. All right I think I understand how this works now. Iâ??m going to say the answer is number 1 only because the others donâ??t seem to add up with what youâ??re saying. Thanks for the help.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Descent'rs have piloted these pages
 
The layout and contents contained within this site are © DescentBB.net 1997-2006.
Descent, Descent II are © Parallax Software Corporation.
Descent III is Outrage Entertainment.
Descent is a Trademark of Interplay Productions.

Miner Wars™ is trademark of Keen Software House s. r. o.
.


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group