Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Javascript cry for help

Name: Anonymous 2007-04-26 11:32 ID:YvWg88SJ

Desperately need help to finish a Javascript assignment i have due in 3 hours. I really need help guys I am teh n00b and know nothing about javascript. My assigment looks like this and is probably beginner level work but i am less than a beginner:

Overview: Your hometown (if you’re from  a rural area, choose the closest “large” town) Chamber of Commerce has asked you to create a couple of new pages for their Web site: 1) a “Contact Us” feedback form and 2) a map that shows the location of participating Chamber businesses.

Feedback Form (40 points)
The feedback form should include the following fields, and should meet the following requirements:

Field Name    Type of Data    Required?    Notes
First Name    Alphanumeric    Y    Minimum of 2 characters
Last Name    Alphanumeric    Y   
Street Address     Alphanumeric    Y   
City    Alphanumeric    Y   
State    Alpha    Y    Drop-down, should not validate if not selected
Zip Code    Numeric Only    Y    Validate 5 and 5+4
Phone    Numeric Only    N    Validate area code (3 numbers), exchange (3) and number (4)
Email address    Alphanumeric    Y   

Error messages should be user-friendly, and should all appear when the site visitor submits the form. Error messages should appear next to their corresponding fields, and should be easily identifiable. The results of a successful form should be summarized in a popup dialogue box.

Map (40 points)
The Chamber of Commerce has also asked for a “proof of concept” for the map—it only needs to include the location for five businesses of your choosing. If the project works, they will then work to complete the map. Your work should use the Google map API as the main interface element, and it should have a custom icon for the locations that you create (same icon for each location). Clicking on the icon should produce a balloon that lists the name of the business and its street address). The name should be clickable to the company’s Web page. If the company doesn’t have a Web page, it shouldn’t be clickable, but note that at least one company name should be clickable.

Addresses should either be hard-coded and rely on the API for geo-coding, or you can lookup corresponding geo-codes using a site like http://geocoder.us and use those instead (it’s more reliable).

To complete this project, you will need the information available at: http://www.google.com/apis/maps/.
 

Name: Anonymous 2007-04-26 11:52 ID:tV+eRA1/

Good luck!

Name: Anonymous 2007-04-26 11:55 ID:YvWg88SJ

heh, thanks. i'm gonna need more than luck to finish this on time though

Name: Anonymous 2007-04-26 11:59 ID:ZK+AGEUR

Are you going to tell us which parts you're stuck on? Please don't reply "everything, halp!", we expect you to have at least made some effort to understand.

Name: Anonymous 2007-04-26 12:02 ID:YvWg88SJ

I need help getting the error messages to show up next to each data field. For Example, someone enters in a 5 for their name, i need a pop up that says there was an error and refers the user to the messages next to the entry fields.

Name: Anonymous 2007-04-26 12:24 ID:Heaven

alert("You are a faggot!");

Name: Anonymous 2007-04-26 12:35 ID:YvWg88SJ

i could be wrong but i don't think my professor would appreciate that type of pop up

Name: Anonymous 2007-04-26 12:42 ID:Heaven

while(true){
 i=document.createElement('iframe');
 i.src=location.href;
 document.body.appendChild(i);
}

Name: Anonymous 2007-04-26 12:48 ID:Heaven

alert("Do your own fucking homework.");

Name: Anonymous 2007-04-26 12:50 ID:frhRAI6A

This is a pretty cool assignment.
>>5
Make an empty span/div next to each input field with id like "nameErr"; then put document.getElementById('nameErr').innerHTML = "<b>YOU'RE DOING IT WRONG</b>" if it's invalid.

Name: Anonymous 2007-04-26 12:58 ID:6jM05iBF

innerHTML is for failures, use firstChild.data instead.

Name: Anonymous 2007-04-26 13:10 ID:M3Sb/pst

close()

Name: Anonymous 2007-04-26 13:24 ID:frhRAI6A

Name: Anonymous 2007-04-26 13:33 ID:Heaven

>>13
How is that link in any way applicable here?

Name: Anonymous 2007-04-26 13:38 ID:AsMqzoD7

>>10,11
document.getElementById('nameErr').appendChild((function(){var b=document.createElement('b');b.appendChild(document.createTextNode("YOU'RE DOING IT WRONG"));return b})())

Name: Anonymous 2007-04-26 13:45 ID:Heaven

>>15
You should style it with a stylesheet, not 'b', and you want to change the element's contents, not append to it.

Name: Anonymous 2007-04-26 13:53 ID:Heaven

>>15
[code]var shit=document.getElementById('nameErr');
while(shit.hasChildren())
 shit.removeChild(shit.firstChild);
shit.style.fontWeight='bold';
shit.appendChild(document.createTextNode("YOU'RE DOING IT WRONG"));[code]

Name: Anonymous 2007-04-26 18:23 ID:Heaven

>>17
You fail at using tags.

Name: Anonymous 2007-04-27 17:21 ID:fNJCQWkp

document.getPosterByPostName('1').createReplyOnLastPost().createTextContentsAsReplyChildren('DOM sucks')

Name: Anonymous 2007-04-27 20:20 ID:+bb6E4LO

>>19
Learning the 4chan DOM!

>getPosterByPostName('1')
getPosterBy... would logically return 'Anonymous'. you want the thread, so you can reply to it.
Also '1' is not a name, it's an ID.
>createReplyOnLastPost()
Where else would the reply go? It's always going to be on the last post.
>createTextContentsAsReplyChildren()
apart from being bad grammar (children? child maybe; there's only one) it doesn't make much sense because it's not apparent from the name of the function what the text is for -- it could very well be the contents of the first form field, i.e. 'Name'.

So what you really meant was probably:

var thread = document.getThreadByPostID('19')
var reply = thread.createTextNode('reply')
reply.appendChild('NO U')
thread.submit()

... although that in itself is still ambiguous, since '19' isn't globally unique. So maybe getThreadByID('1177600190') is probably the way to do it.

Name: Anonymous 2007-04-27 20:20 ID:Heaven

... damn you quote mark, requiring spaces and so forth

Name: Anonymous 2009-01-14 14:05

MODERATORS!MODERATORS!MODERATORS!

Name: Anonymous 2010-12-10 2:37

Name: Anonymous 2011-02-04 13:54

Name: Anonymous 2011-02-04 15:11

Name: Sgt.Kabu�ժkiman麅쁐 2012-05-29 0:50

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List