Question

Debug JavaScript

Asked by: dschafer77

I need help debugging the following program.

Daniel


<html>
<title>Conquer_Parks_2</title>
<head>
 
<SCRIPT LANGUAGE="JavaScript">
<!--
function Bier()
{
var s=window.document.Schweinehund;
var x=0;
for (i=0;i<6;i++)
  {
    if (s.elements(i).checked)
    {  
       var RadioValue=fred.elements(i).value;
    }
  }
for (i=5;i<10;i++)
  {
    var CheckTrue=0             
    if (s.elements(i).checked==true)  
    {
      CheckTrue=CheckTrue+1;    
    }
    if (CheckTrue<=1)
    {  
       alert("Select at least one value");
       return;
    }
    if (s.elements(i).checked)
    {
       var SName=SName + s.elements(i).name + " ";
       return;
    }
  }  
  if (s.c1.value=="default")
    {
      alert ("Select a value other than 0-4 Beers");
      return;
    }

      
var oldcharA=s.d1.value;
var oldcharlenA=oldcharA.length;
var newcharA=oldcharA;

for (i=0;i<oldcharlenA;i++)
   {
        newcharA=newcharA.replace("/","");
        newcharA=newcharA.replace("\\","");
        newcharA=newcharA.replace("*","");

   }
var newcharlenA=newcharA.length;

var oldcharB=s.d1value;
var oldcharlenB=oldcharB.length;
var newcharB=oldcharB;

for (i=0;i<oldcharlenB;i++)
    {
        newcharB=newcharB.replace(" ","+");
        newcharB=newcharB.replace("\n","");
        newcharB=newcharB.replace("\r","");
    }

var newcharlenB=newcharlenB.length;

     document.clear
     document.open
     document.write("<html><body bgcolor='#ffffc0'><center>");
     document.write("<table width='90%' bgcolor='#ffffc0' border='10'><tr><td colspan='4'>");
     document.write("<center><b><h1>Output Report</h1></b></center></td></tr><tr><td colspan='4'>&nbsp;</td></tr>");
     document.write("<tr><td colspan='4' align='center'><b><h3>Radio Buttons</h3></b></td>");
     document.write("<tr><td>Name of Radio Button: a1</td><td>Value of each radio button: Warsteiner, Früh Kölsch, Paulaner Franziskaner, Diebels Alt, Bitburger, Becks </td>");
     document.write("<td>Radio button checked at load time: Radio 1</td><td>Radio button checked by user: " & Radio_Value);
     document.write("</td</tr><tr><td colspan='4'>&nbsp;</td></tr><tr><td colspan='4' align='center'><b><h3>Checkboxes</h3></b></td></tr>");
     document.write("<tr><td colspan='2'>Name of each checkbox: B1, B2, B3, B4</td><td colspan='2'>Selected Value: " & SName);
     document.write("</td></tr><tr><td colspan='4'>&nbsp;</td></tr>" +chr(10)+chr(13) + "<tr><td colspan='4' align='center'><b><h3>Selectbox</h3></b></td></tr>");
     document.write("<tr><td>Name of the select box: c1</td><td>Options and associated values: <ul><li>First one, First one<li>Second optiom, Second option<li>");
     document.write("Third option, Third option<li> Fourth option, Fourth option<li>Fifth option, Fifth option<li>Sixth option, Sixth option</ul></td>");
     document.write("<td>Index of the initial selection and its value: O, First one</td>");
     document.write("<td>Index and value of initial selected by user: " & c1_value);
     document.write("</td><tr><td colspan='4'>&nbsp;</td></tr><tr><td colspan='4' align='center'><b><h3>Textbox</h3></b></td></tr>");
     document.write("<tr><td>Name of the Textbox: d1</td><td>Original contents and length: Null, 0</td>");
     document.write("<td>Users entry and length of entry before editing: " & oldcharA & " and " & oldcharlenA & "</td>");
     document.write("</td><td>User's entry and length of entry after editing: " & newcharA & " and " & newcharlenA);
     document.write("</td></tr><tr><td colspan='4'>&nbsp;</td></tr><tr><td colspan='4' align='center'><b><h3>Textarea</h3></b></td></tr>");
     document.write("<tr><td>Name of textarea: e1</td><td>Original Contents and length: default value, 13</td>");    
     document.write("<td>User's entry and length of entry before editing: " & oldcharB & " and " & oldcharlenB);
     document.write("</td><td>User's entry and length of entry after editing:" & newcharB & " and " & newcharlenB);
     document.write("</td></tr></center></table></body></html>")    

}      



</script>
</head>
<body bgcolor="ffffc0">
<Form name="Schweinehund">
<center><b><h1>Beer Survey</h1></b></center>
<p><br>
<center><table border="0" width="90%" bgcolor="ffffc0">
<tr><td colspan="6">&nbsp; <br></td></tr>
<tr><td colspan="6"><center><b><h3>What is your favorite German beer?</h3></b></center></td></tr>
<tr>
  <td>Warsteiner<input type="radio" name="a1" checked value="Warsteiner"></td>
  <td>Früh Kölsch<input type="radio" name="a1" value="Früh Kölsch"></td>
  <td>Paulaner Franziskaner<input type="radio" name="a1" value="Paulaner Franziskaner"></td>
  <td>Diebels Alt<input type="radio" name="a1" value="Diebels Alt"></td>
  <td>Bitburger<input type="radio" name="a1" value="Bitburger"></td>
  <td>Becks<input type="radio" name="a1" value="Becks"></td>
</tr>
<tr><td colspan="6">&nbsp;<p>&nbsp; <p></td></tr>
<tr><td colspan="6"><center><b><h3>Which store in Houston offers the best beer variety?</h3></b></center></td></tr>
<tr>
  <td colspan="6">
          <table border="0" width="100%" bgcolor="ffffc0">
          <tr>
               <td>Spec's Liquor, Downtown<input type="checkbox"  name="b1" value="b1"></td>
               <td>Central Market<input type="checkbox"  name="b1" value="b2"></td>
               <td>Randall's<input type="checkbox"  name="b1" value="b3"></td>
               <td>Citgo<input type="checkbox"  name="b1" value="b4"></td>
          </tr>    
          </table>
  </td>
</tr>
<tr><td colspan="6">&nbsp;<p>&nbsp; <p></td></tr>
<tr><td colspan="6"><center><b><h3>How many beers does it take for you to call your ex-girl friend in the middle of the night?</h3></b></center></td></tr>
<tr>
  <td colspan="6">
  <center>
  <select name="c1">
          <option value="default" selected>0-4 Beers (Domestic brew)
          <option value="Second option">0-6 Beers (Mix between domestic and import)
          <option value="Third option">0-8 Beers (The darker the better)
          <option value="Fourth option">0-10 Beers (Doppelbock)
          <option value="Fifth option">> 10 Beers (Beer and liquor mix)
          <option value="Sixth option">> 10 Beers (I don't remember)
     </select>
     </center>
  </td>
</tr>
<tr><td colspan="6">&nbsp;<p>&nbsp; <p></td></tr>
<tr><td colspan="6"><center><b><h3>What is the English word for Reinheitsgebot?</h3></b></center></td></tr>
<tr>
  <td colspan="6"><center><INPUT TYPE="text" NAME="d1" maxlength="30"></center></td>
</tr>
<tr><td colspan="6">&nbsp;<p>&nbsp; <p></td></tr>
<tr><td colspan="6"><center><b><h3>This is your chance to make any constructive comments:</h3></b></center></td></tr>
<tr>
  <td colspan="6"><center><textarea name="e1" rows="5" cols="50">Reinheitsgebot (German Purity Law) adopted in 1516, still enforced to protect the consumer.  Under this law you can only use water, yeast, hops and barley-malt to brew beer. </textarea>
</tr><tr><td colspan="6">&nbsp;</td>
</tr><tr>
  <td colspan="6">
  <center>
          <input type="button" value="Edit and Report" name="Bier" >
  </td>
</tr>
</table></center>
</form>
</body>
</html>

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2002-10-22 at 06:00:29ID20379022
Tags

diebels

,

form

,

javascript

Topic

Web Languages/Standards

Participating Experts
4
Points
70
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. How To Read The Network Adopter Address?
    Hello! I would like read the network adopter address on win95/98 an d NT. Please help? Thanks!
  2. debugging javascript
    How can I best debug javascript error? When I run the site using IE 6, I get the window content and the pop-up error message "object required" at line 243.. etc... Then I try to run it with Mozilla to debug, but instead of getting a window content, I just get a pag...
  3. Customized Marketing Solution
    I currently have a dbase subscription product in use by over 1000 different clients. These clients keep lists of their own clients with their marketing preferences in their dbase. They have name/address/phone/email along with order information. They also have the very impo...
  4. stock market overview script?
    I've been looking for a stock market overview script that I can insert into a page. Just like the one on: http://www.quotemedia.com/demoarea/markets.php The ones on the right are the type of thing I'm looking for. Basically just an overview of the most popular markets out t...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tonejunkiePosted on 2002-10-22 at 06:45:41ID: 7356185

Yeah... have fun!

 

by: InnerChildPosted on 2002-10-22 at 09:36:39ID: 7356872

I'll try but you need to tell me whats wrong?  Exactaly what I need to do to break it ;)  

LAter

 

by: dschafer77Posted on 2002-10-22 at 09:52:21ID: 7356935

Hi InnerChild,

It seems to me that the algorithm and syntax for the sub is not correct. The html part works.
Check out the requirements for this assignment and you will get the bigger picture.
 
http://www.bauer.uh.edu/~parks/disc337x.htm
I already finished the VBScript part.

Daniel

 

by: InnerChildPosted on 2002-10-22 at 10:12:11ID: 7357007

So well you know its not working right?  One thing I noticed is that you have one to many option in your drop down.  You teacher wanted 5 you hve 6.  So you want what though somebody to clean up the code or make it work?

 

by: dschafer77Posted on 2002-10-22 at 10:19:26ID: 7357031

I would like to have somebody make the code work according to the assignment requirements.

Regards
Daniel

 

by: BushweilerPosted on 2002-10-22 at 11:52:29ID: 7357424

watch it guys....

http://www.experts-exchange.com/Community_Support/New_to_EE/Q_20310436.html

violating the guidelines for academic honesty or other unethical behavior.

 

by: InnerChildPosted on 2002-10-22 at 12:05:46ID: 7357490

Thanks for the tip

LAter

 

by: dschafer77Posted on 2002-10-22 at 12:28:43ID: 7357576

My request is in the guidelines for acdemic honesty since  this is a working sample that will not be graded.

Daniel

 

by: BushweilerPosted on 2002-10-22 at 13:15:44ID: 7357726

thx Daniel, just checking.

BTW, <TITLE> should be within the <HEAD>

In broad terms you're missing a form action and a submit mechanism.  Those document.write()s will have no effect (page is already displayed).  The form could check validity (which you've started coding) and then post to another page (though the <FORM METHOD="GET"> should be used)

You can use the following to get the Key-value pairs on the second page (after the post):
var keyvals = location.search.substring(1).split("&");

 

by: NetminderPosted on 2002-10-22 at 16:20:34ID: 7358219

dschafer77,

Bushweiler has offered you a link to the Membership Agreement to which you are a party, and to which you have agreed.

Please understand that it's okay for Experts to guide you, but it's not okay for them to do your homework. Ungraded or not, an assignment by a teacher is still homework.

Also please understand that the ramifications are not only for your account, but for the Expert who does your homework for you.

Netminder
CS Moderator

 

by: dschafer77Posted on 2002-10-22 at 18:56:37ID: 7358602

I understand the Membership Agreement and my action is in compliance with the guidlines.

The assignment ,which is from last year, is used as a working example and is not part of any homework.

I appreciate your help.

Regards
Daniel

 

by: dschafer77Posted on 2002-10-22 at 19:08:17ID: 7358633

A+
Good job

 

by: BushweilerPosted on 2002-10-23 at 08:56:29ID: 7361112

thx Daniel, just watch out with the homework posts 'cause it gets us all in trouble... and this is a great technical resource so it would be a shame to get it blacklisted.

Thanks again,
--Lee

Netminder,
Thanks again for the full clarification on that policy.
--Lee

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...