lance_sibley: (Part Geek All Man)
[personal profile] lance_sibley
Tonight, in Internet Scripting Languages, there was no lecture to speak of. The instructor handed out a lab exercise and we spent the entire three hours working on it. Oy.

Apparently, though, I tried to get too fancy... we were supposed to be writing a number-guessing game, where a random number from 0 to 100 is generated. The player has five guesses, and after each one, the Javascript is supposed to return a line of text saying whether the guess was too high, too low or correct and write it to the HTML page. I got bored and started trying to make the input a form rather than a Windows prompt, but apparently the HTML button's onClick method can't access the Javascript variable that contains the randomly-generated number. (What good is that?) There has to be a way...

I've gotten my first assignment done for the class, which is due Wednesday night, though. As described in my last post, it's supposed to be an airline website, with pages for user registration and login, a search page for flights, a page for specific flight information, FAQs, and a panel of advertising. It's here, if anyone wants to have a look. But be warned, it's not pretty. A designer I am not. ;) And since we don't yet know how to link to a database, obviously the data for the search and flight info pages had to be hard-coded just to prove that the functionality to display the information would work. I leave it as an exercise for the reader to find out just what the information is for that one flight. ;) Oh, and it should work in both Internet Exploder Explorer and Firefox. I don't know about any other browsers.

Date: 2006-11-07 07:08 am (UTC)
From: [identity profile] mzrowan.livejournal.com
The scope of a Javascript variable depends on where and how you declare it. You have to declare it in the header, and I *think* with the var keyword, in order for all the scripts on the page to have access to it.

(And on a side note, I'm very surprised that they haven't covered something as basic as variable declarations and scope by this point.)

Date: 2006-11-07 07:22 am (UTC)
From: [identity profile] boywhocantsayno.livejournal.com
Oh, he has covered the declarations (and yes, "var" is the keyword), and he talked about scope tonight. (Nothing I didn't already know, as I'm finding that Javascript has a lot of similarities to C#, and we'd already covered this in C#.) I may just be describing the problem incorrectly, as I didn't email myself the files containing my code (which is the only way I can work on stuff here at home, as there is no remote access to the school's system).

I think what I was trying to do was create a button which, when clicked, would call the function that would determine whether the number entered was higher or lower than the random number generated. The onClick statement in the button definition didn't recognize the variable.

Though now that I'm thinking about it, I think I coded it as "onClick='checkNum(randomNum, guessedNum)'" instead of "onClick='checkNum(randomNum.value, guessedNum.value)'", since I know for a fact that the latter works as I used something similar in the assignment. I'll have to have a look tomorrow night when I'm back over there for my C# class.

Date: 2006-11-07 07:06 pm (UTC)
From: [identity profile] gurudata.livejournal.com
Hiho,

Oh, and it should work in both Internet Exploder Explorer and Firefox. I don't know about any other browsers.

It works fairly well in Opera. Although some of the text is hard to read on the image background...

And what? No link to TT on the side? :)

Cu,
Andrew

Date: 2006-11-07 08:57 pm (UTC)
From: [identity profile] boywhocantsayno.livejournal.com
It works fairly well in Opera.

Thanks - that's one I didn't think to check as I rarely use it (I did download it some months ago).

Although some of the text is hard to read on the image background...

Yeah, I know... I was playing with various colours and the red seemed to be the most consistently legible (though it would be a problem for the colour-blind). I've had similar problems when making LJ icons - there's no one colour that shows up against all backgrounds unless I wanted to make it 24pt bold.

This reminds me, I wanted to change my screen resolution and make sure everything still looked okay (I'm using percentages for my frame sizes, so it should).

As [livejournal.com profile] cuteteenboy pointed out in an earlier post, background images are usually frowned upon, but we're supposed to be showing that we can use a wide variety of styles.

And what? No link to TT on the side? :)

Hee. I should add it. :)

Date: 2006-11-08 03:31 pm (UTC)
From: [identity profile] gurudata.livejournal.com
Hiho,

background images are usually frowned upon, but we're supposed to be showing that we can use a wide variety of styles.

What a lot of people do now to strike a compromise is to put the image once at the top, then put a "watermarked" version of the same image repeating below. Text shows up a lot better on watermarked text than on standard images.

Of course, any REAL web site developer would say it's all about content, style is irrelevant. :)

Cu,
Andrew

Date: 2006-11-08 09:03 pm (UTC)
From: [identity profile] boywhocantsayno.livejournal.com
What a lot of people do now to strike a compromise is to put the image once at the top, then put a "watermarked" version of the same image repeating below. Text shows up a lot better on watermarked text than on standard images.

Now that's something I hadn't thought of - I'll remember that for next time.

Of course, any REAL web site developer would say it's all about content, style is irrelevant. :)

In that case, I'll make my next website with lime green text on a fuchsia background. Screw the colour-blind, and make the non-colour-blind completely blind. :P

Date: 2006-11-07 07:42 pm (UTC)
From: [identity profile] kanecool.livejournal.com
It seems to work ok on Netscape as well, in case you were wondering. :)

Date: 2006-11-07 08:59 pm (UTC)
From: [identity profile] boywhocantsayno.livejournal.com
Thanks - that's good to know! I don't have Netscape, so I wouldn't have been able to check it there myself. (Eventually I'm sure I'll download it just so that I can test my webpages in as many different browsers as possible - I only have IE, FF and Opera, though I didn't think to check it in Opera. Fortunately [livejournal.com profile] gurudata did. :) )

Date: 2006-11-08 08:11 pm (UTC)
From: [identity profile] evil-admiral.livejournal.com
Makes sense it would work fine in Netscape if it works fine in Firefox, since Mozilla is essentially using souped up Netscape code for the main guts of the browser.

Date: 2006-11-08 08:39 pm (UTC)
From: [identity profile] boywhocantsayno.livejournal.com
Oh, I didn't realize that. Interesting... I wonder how Netscape feels about that. (It's not open source, is it?)

Date: 2006-11-08 08:09 pm (UTC)
From: [identity profile] evil-admiral.livejournal.com
The website is spiffly, and it works fine in Firefox! :)

Date: 2006-11-08 08:38 pm (UTC)

Profile

lance_sibley: (Default)
lance_sibley

June 2009

S M T W T F S
 123456
78910111213
14 151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 14th, 2025 02:29 pm
Powered by Dreamwidth Studios