Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with my javascript Assignment

    Hello everyone, i'm new here, i'm currently studying to become a web designer at my local college i've been given this assignment and i searched all over the net for solutions and no luck so I registered hear to ask for your knowledge and wisdom to assist me so that way I can understand it better. this is the assignment im working on, i'm listing the link to the pdf of my assignment.....and please to each solution list the task number for me too please. http://daora-d.com/pdf/Assignment.pdf


    id appreciate it too.

    Cheers

    Daora

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,980
    Thanks
    56
    Thanked 557 Times in 554 Posts
    Quote Originally Posted by daora View Post
    please to each solution list the task number for me too please.
    seriously? How are you planning on filling in this section:
    I CERTIFY THAT THIS ASSIGNMENT TASK IS MY OWN WORK & I HAVE REFERENCED ALL MATERIALS USED FROM ALL OTHER SOURCES.

    ?

    How about you post what you have done so far and the problems that you are having? That way you might actually learn something and probably won't be accused of cheating.

  • #3
    New to the CF scene
    Join Date
    May 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by xelawho View Post
    seriously? How are you planning on filling in this section:
    I CERTIFY THAT THIS ASSIGNMENT TASK IS MY OWN WORK & I HAVE REFERENCED ALL MATERIALS USED FROM ALL OTHER SOURCES.

    ?

    How about you post what you have done so far and the problems that you are having? That way you might actually learn something and probably won't be accused of cheating.
    I had a talk with the teacher and he said as long i comment on were I acquired the scripts from and have my own comments. so me asking for help on here will be no problem

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    So what code do you have so far.

    No one here will write a script for you but we will help if you have at least tried to write some code and it doesn't quite work.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New to the CF scene
    Join Date
    May 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <style>
    	body{
    		font-family:Verdana, Geneva, sans-serif;
    		font-size:12px;
    	}
    	fieldset{
    		width:512px;
    	}
    	table, td, th{
    		padding:0px;
    		margin:10px;
    		border:none;
    	}
    	#sub{
    		margin:0px;
    	}
    	th{
    		vertical-align:text-top;
    		text-align:right;
    		padding-right:10px;
    		font-weight:normal;
    		width:100px;
    	}
    	.alt{
    		background-color:#eee;
    	}
    	.errorBeans {
    		display:none;
    	}
    	.errorType {
    		display:none;
    	}
    	.errorName {
    		display:none;
    	}
    	.errorAddress {
    		display:none; 	
    	}
    	.errorCity {
    		display:none;
    		
    	}
    	.errorState {
    		display:none;
    	}
    	.errorPost {
    		display:none;
    	}
        </style>
    <script type="text/javascript" language="javascript">
    function validate(beanForm)
    			{
    				errorflag=0
    			}if document.getElementById(beans).value=true 
    		
    			return:false;}
    			}
    </script>
    </head>
    
    <body>
    <h2>Task 3 – 15 Marks</h2>
    <p style="font-weight:bold; color:black;">Create a form as described below with any relevant validation for StarBuzz’s coffee ordering page. Use the Html provided.</p>
    <form id="beanForm">
    	<fieldset><legend>The Starbuzz Bean Machine</legend>
    	<table>
        	<tr class="alt">
            	<th>Choose your beans:</th>
                <td>
                	<select id="beans" name="beans">
                        <option value="House Blend">House Blend</option>
                        <option value="Bolivia">Shade Grown Bolivia Supremo</option>
                        <option value="Guatemala">Organitc Guatemala</option>
                        <option value="Kenya">Kenya</option>
        			</select><br />
     				<span class="errorBeans" style="color:red;">Please make a selection</span>
                </td>
            </tr>
            <tr>
            	<th>Type:</th>
                <td>
                	<label><input id="beantype" name="beantype" type="radio" value="whole" /> Whole Bean</label><br/>
        			<label><input id="beantype" name="beantype" type="radio" value="ground" /> Ground</label><br />
    				<span class="errorType" style="color:red;" >Which bean would you like?</span>
        		</td>
            </tr>
            <tr class="alt">
            	<th>Extras:</th>
                <td>
                	<label><input id="extras[]" name="extras[]" type="checkbox" value="giftwrap" /> Gift Wrap</label><br/>
        			<label><input id="extras[]" name="extras[]" type="checkbox" value="catalog" /> Include a catalog</label>
                </td>
            </tr>
            <tr>
            	<th>Ship to:</th>
            	<td>
                	<table id="sub">
                    	<tr>
                        	<td>Name:</td>
                            <td><input id="name" name="name" type="text" /><br />
    						<span class="errorName" style="color:red;">Please enter your name</span></td>
                        </tr>
                        <tr>
                        	<td>Address:</td>
                            <td><input id="address" name="address" type="text" /><br />
    						<span class="errorAddress" style="color:red;">Your address is required</span></td> <!-- The error will come up if there was no input added in the address link -->
                        </tr>
                        <tr>
                        	<td>City:</td>
                            <td><input id="city" name="city" type="text" /><br />
    
                            <span class="errorCity" style="color:red;">Please insert your city</span></td>
                        </tr>
                        <tr>
                        	<td>State:</td>
                            <td><input name="state" type="text" id="state" size="8" maxlength="8" /><br />
    						<span class="errorState" style="color:red;">Please insert your state</span></td>
                        </tr>
                        <tr>
                        	<td>Post Code:</td>
                            <td><input name="zip" type="text" id="zip" size="4" maxlength="4" /><br />
    						<span class="errorPost" style="color:red;">Incorrect values</span></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr class="alt">
            	<th>comments:</th>
                <td>
                	<textarea id="comments" name="comments" cols="45" rows="10"></textarea>
                </td>
            </tr>
            <tr>
            	<td>&nbsp;</td>
                <td><input type="submit" value="Submit" onClick =""/></td>	
            </tr>
        </table>
    	</fieldset>
    </form>
    
    </body>
    </html>
    This is what i tried to achieve so far.....but im all out of ideas i know it involves if statements but i dont know how to construct it.......i gave the attribute names for each value example name=beans.

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    In your beans select list you must supply a starting option (or make one choice pre-selected so that whatever happens an option is selected).

    Code:
    <option value = "0" >Choose a type of bean... >
    and then in script

    Code:
    var val = document.beanForm.beans.value;
    which will return the selected value. If that value == 0 then the user has not made a selection - try again. Obviously if one option is pre-selected then there is no need to make a check, but you still need to capture the value of the selection.

    But your very limited Javascript code offering suggests that you really have little knowledge of Javascript.

    Be aware that <seript language = "Javascript"> has been obsolete since 1997.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by Old Pedant View Post
    And this is completely wrong:

    fahrenheit = (celsius * 8/6) + 46;

    Maybe you should go look up the *correct* formula.
    And maybe you should post in the right thread!

    http://www.codingforums.com/showthread.php?t=262391

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    Hashim1 (05-23-2012)

  • #8
    Regular Coder
    Join Date
    Dec 2010
    Location
    Sheffield, UK
    Posts
    138
    Thanks
    81
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Philip M View Post
    Be aware that <seript language = "Javascript"> has been obsolete since 1997.
    What do you mean by this, Philip M? Do you mean the script tags themselves have become obsolete?
    http://www.topcashback.co.uk/ref/hashim1

    ^
    Total earnings so far: £25.15
    A very generous cashback site worth checking out.


  • #9
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by Hashim1 View Post
    What do you mean by this, Philip M? Do you mean the script tags themselves have become obsolete?
    No, of course not. Don't be silly! Surely you know this! It has been mentioned in this forum a zillion times!

    <script language=javascript> is long deprecated (since 1997). Use <script type = "text/javascript"> instead (in fact also deprecated but still necessary for IE<9). The <!-- and //--> comment (hiding) tags have also not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that you are looking at ancient and perhaps unreliable code.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,869
    Thanks
    79
    Thanked 4,421 Times in 4,386 Posts
    Quote Originally Posted by Philip M View Post
    And maybe you should post in the right thread!

    http://www.codingforums.com/showthread.php?t=262391
    I guess the moderator moved it between the time I opened this thread and the time I posted.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •