Front Office Football Central  

Go Back   Front Office Football Central > Main Forums > Off Topic
Register FAQ Members List Calendar Mark Forums Read Statistics

Reply
 
Thread Tools
Old 03-08-2011, 10:18 PM   #1
Rizon
Pro Starter
 
Join Date: Mar 2004
Location: Oakland, CA
Basic javascript help

I'm trying to get this code to output first and last name into the 3rd box. It's not working and I'm not sure why. Any help?

*I can't figure out how to put code in here, so I just attached the file.
__________________
Quote:
Originally Posted by Pumpy Tudors View Post
It's hard to throw a good shot with a drunk blonde wrapped around me.
Quote:
Originally Posted by Suicane75 View Post
I don't think I'd stop even if I found a dick.

Rizon is offline   Reply With Quote
Old 03-09-2011, 04:28 AM   #2
3ric
College Starter
 
Join Date: Dec 2000
Location: Sweden
I'm not seeing any attachment?
__________________
San Diego Chargers (HFL) - Lappland Reindeers (WOOF) - Gothenburg Giants (IHOF)
Indiana: A TCY VC - year 2044 - the longest running dynasty ever on FOFC!
3ric is offline   Reply With Quote
Old 03-09-2011, 06:31 AM   #3
Ronnie Dobbs2
Pro Rookie
 
Join Date: Jun 2012
Location: Bahston Mass
Code:
I think it's (bracket)code(bracket)CODE GOES HERE(bracket)/code(bracket).

Replace the (bracket) with [ and ] obv.

But yeah, nothing attached on my end either.
__________________
There's no I in Teamocil, at least not where you'd think

Last edited by Ronnie Dobbs2 : 03-09-2011 at 06:32 AM.
Ronnie Dobbs2 is offline   Reply With Quote
Old 03-09-2011, 10:02 AM   #4
Rizon
Pro Starter
 
Join Date: Mar 2004
Location: Oakland, CA
Oops. Here it is

HTML Code:
<html> <head> <title> COMSC 100 WorkbookAssignment 4 </title> <script> function GO() { // declare a variable var firstName; // get variable's value firstName = document.getElementById("firstName").value; // insert the value of firstName insert(firstName) // declare a variable var lastName; // get variable's value lastName = document.getElementById("lastName").value; // insert the value of lastName insert(lastName) // declare a variable var fullName; // get variable's value fullName = firstName.value + " " + lastName; } </script> </head> <body> Instructions: Type your first and last name, then click GO and a greeting will appear. Input values: First Name: <input id=\"firstName\"> Last Name: <input id=\"lastName\"> <input type=\"submit\" value=\"GO\" onclick=\"GO()\"> Output value: Happy New Year, <input type=\"fullName\"> </body> </html>[html]
[/html]
__________________
Quote:
Originally Posted by Pumpy Tudors View Post
It's hard to throw a good shot with a drunk blonde wrapped around me.
Quote:
Originally Posted by Suicane75 View Post
I don't think I'd stop even if I found a dick.
Rizon is offline   Reply With Quote
Old 03-09-2011, 10:03 AM   #5
Rizon
Pro Starter
 
Join Date: Mar 2004
Location: Oakland, CA
Trying to get it to look like this, where the you enter your first and last name, hit GO and it puts your full name in the last box.



<br /> COMSC 100 WorkbookAssignment 4<br />




Instructions:

Type your first and last name, then click GO

and a greeting will appear.



Input values:


First Name:

Last Name:





Output value:

Happy New Year,



__________________
Quote:
Originally Posted by Pumpy Tudors View Post
It's hard to throw a good shot with a drunk blonde wrapped around me.
Quote:
Originally Posted by Suicane75 View Post
I don't think I'd stop even if I found a dick.
Rizon is offline   Reply With Quote
Old 03-09-2011, 10:26 AM   #6
Coffee Warlord
Head Coach
 
Join Date: Oct 2002
Location: Colorado Springs
Code:
function popFull() { form1.fullname.value = form1.firstName.value + " " + form1.lastName.value; }

That's all you need. Call popFull as an onClick in the 'go' button, done.

HTML Code:
<form name='form1'> <input type='text' name='firstName'> <input type='text' name='lastName'> <input type='text' name='fullname'> <input type='button' value='Go' onClick=\"popFull();\">

Last edited by Coffee Warlord : 03-09-2011 at 10:28 AM.
Coffee Warlord is offline   Reply With Quote
Old 03-09-2011, 12:23 PM   #7
Rizon
Pro Starter
 
Join Date: Mar 2004
Location: Oakland, CA
Thanks CW. I'm totally code illiterate, so I'm not sure what to replace to the old code or where to add your code or both? We're supposed to be learning this in class, but the teacher gives the same story about cake and we don't seem to be learning any JS or HTML.
__________________
Quote:
Originally Posted by Pumpy Tudors View Post
It's hard to throw a good shot with a drunk blonde wrapped around me.
Quote:
Originally Posted by Suicane75 View Post
I don't think I'd stop even if I found a dick.
Rizon is offline   Reply With Quote
Old 03-09-2011, 12:32 PM   #8
Coffee Warlord
Head Coach
 
Join Date: Oct 2002
Location: Colorado Springs
What I gave you is basically the completed everything. You only need that one line of javascript to accomplish what you want, and I included the actual necessary portion of the html. You'll need to add like the html/body/etc tags and such, but the meat is all there.

Last edited by Coffee Warlord : 03-09-2011 at 12:34 PM.
Coffee Warlord is offline   Reply With Quote
Old 03-09-2011, 03:23 PM   #9
Ronnie Dobbs2
Pro Rookie
 
Join Date: Jun 2012
Location: Bahston Mass
If you wanted to do it with your original code (which might be more appropriate for a CSCI 1 assignment) I would ask you to look at the insert function. You are saying WHAT to insert, but not including WHERE.
http://www.prototypejs.org/api/element/insert
__________________
There's no I in Teamocil, at least not where you'd think
Ronnie Dobbs2 is offline   Reply With Quote
Old 03-09-2011, 03:50 PM   #10
Coffee Warlord
Head Coach
 
Join Date: Oct 2002
Location: Colorado Springs
Learn it the efficient way, dammit. Don't learn bloated programming techniques.
Coffee Warlord is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT -5. The time now is 05:14 AM.



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.