LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2005, 11:44 AM   #1
swatward
Member
 
Registered: Jan 2005
Distribution: slackware
Posts: 83

Rep: Reputation: 15
Thumbs up Javascript??


Why am i not able to get this to return the imput?
any help greatly appreciated.

Thanks,
Brad

P.S.Here is the file that im talking about
Code:
<html>
<head>


<title>Robots 4 Sale</title>
<script>
function calculate_total( bb)
{
document.write("Type: " + bb)
}
</script>
</head>

<body bgcolor="#708090">

<script language="JavaScript1.2">
if (document.all||document.getElementById)
document.body.style.background="url('bg.jpg') bottom right no-repeat fixed"
</script>


<center><marquee bgcolor=dodgerblue width=250 ><h1>ROBOTS!
<img src="images/1.jpg"><img src="1.jpg"><img src="1.jpg">
</h1></marquee></center>
<font face="Batang">

<p><br><br>
Domo Arigato Mr. Roboto. <br>
How many times have you wanted to not clean up your room, or do anything at all?
Do you remember the last time you wished you had a bodyguard or a helper robot?
<br>Well now you dont have to!<br>
</p>




   <form name="joes"><br>
   <input type="radio" name="bb" value="generic">Generic Robot<br>
   <input type="radio" name="bb" value="helper">Helper Robot<br>
   <input type="radio" name="bb" value="bodyguard">Body Guard<br>
   <input type="radio" name="bb" value="killer">Killer Robot <br>
   <input type="submit" name="submit" value="submit" onclick="calculate_total(joes.bb.value)">
   </form>





</font>
</body>
</html>

Last edited by swatward; 05-05-2005 at 05:49 PM.
 
Old 05-06-2005, 04:51 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Try to name your checkbox with an unique name, like bb1, bb2...

If you want to capture checkbox value, try :
Code:
<script>
global_type = "generic"; // default to generic
function update_type( type )
{
    global_type = type;
}
function calculate_total()
{
document.write("Type: " + global_type);
}
</script>
...
   <form name="joes"><br>
   <input type="radio" name="bb" value="generic" onclick="update_type(this.value)">Generic Robot<br>
   <input type="radio" name="bb" value="helper" onclick="update_type(this.value)">Helper Robot<br>
   <input type="radio" name="bb" value="bodyguard" onclick="update_type(this.value)">Body Guard<br>
   <input type="radio" name="bb" value="killer" onclick="update_type(this.value)">Killer Robot <br>
   <input type="submit" name="submit" value="submit" onclick="calculate_total();">
   </form>

Last edited by keefaz; 05-06-2005 at 05:00 AM.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MythTV claims all my inputs are in use. None actually are Pcghost Linux - Software 2 03-24-2005 10:42 AM
javascript alerts with radio modules graziano1968 Programming 3 11-10-2004 03:14 AM
No Sound from Motherboard Inputs? braincandy99 Slackware 3 07-18-2004 06:22 AM
X-Net Radio! Internet Radio with an attitude! xnetradio General 1 01-11-2004 11:01 AM
getting info on video inputs Jo_Nak Programming 1 06-16-2003 03:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration