Results 1 to 2 of 2

Thread: Here is my dilemma........

  1. #1
    Join Date
    Mar 2012

    Here is my dilemma........

    I am new to the world of programming. I currently in my sophomore year of a software engineering bachelors program. This semester was suppose to be a introductory class to JavaScript. I'm a night-class student full-time age 34 making a career change. Not stupid in any means (3.87GPA) i learn when taught properly. Well needless to say i have a first time teacher who never taught before. Excellent webdeveloper, not so good of a teacher. Just cant make that connection with students. whole class is *****ing they dont know what hes talking about. Doesnt know how to teach javascript basics. skips a lot of the coding in the middle. I have an A in the class along with all of my other classmates and i haven't learned a lick. Which SUCKS cuz javascript is an important language to know a little about when you jump out into the workforce.

    this is the XHTML code that was given to work with:

    /*<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html xmlns="http://www.w3.org/1999/xhtml">
    <title>Temperature Converter</title>
    <link rel="stylesheet" type="text/css" href="default.css" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="convert_temp.js"></script>
    <div id="content">
    <h1>Convert temperature</h1>

    <input type="radio" name="conversion_type" id="to_celcius" checked="checked" />From Fahrenheit to Celcius<br />
    <input type="radio" name="conversion_type" id="to_fahrenheit" />From Celcius to Fahrenheit<br />
    <br />

    <label>Degrees Fahrenheit:</label>
    <input type="text" id="degrees_fahrenheit" class="disabled" /><br />
    <label>Degrees Celcius:</label>
    <input type="text" id="degrees_celcius" disabled="disabled" class="disabled"/><br />
    <br />

    <input type="button" id="convert" value="Convert" /><br />
    <br />

    Not the issue because this was given, now the assignment is to:

    1....If the user selects one of the radio buttons, this application disables the text box that's used to diplay the results of the calculation, it enables the text box that's used to get the data from the user, and it removes any data from both text boxes

    2....This application displays the concerted temperature in the disabled text box when the user clicks on the convert button

    Functional specs
    ---formula for converting fahr to cels... celsius = (fahr - 32) * 5/9
    ---formula for converting cels to fahr.... fahr = cels * 9/5 + 32
    ---this application should accept decimal entries like 77.5, but it should round the result of the conversion to the nearest int value
    ---this application should validate data to make sure that the user enters a valid number for the conversion

    Additional coding requirements

    ---To demonstrate you know how to write and use a function (LOLOLOL) that returns a value in javascript, use a separate function for at least one of the temperature conversions

    --to demonstrate knowledge of techniques related to form validation, use a regular expression to ensure the input values are valid (dont forget about negative numbers, but you can ignore octal and hexadecimal temperatures

    That is the assignment!

    Ill show you what i've done in the on the .js page...Its doing something but nothing right (lolol)....its keeping my degrees celsius text box always in read only, the conversion in the math seems screwed up, everytime i hit convert button the value inside the celsius box which is in read only stays there and i"m not gonna type evrything that is wrong here you can probably find what im doing completely wrong just from my code so here it is.......its incomplete just running into trouble and figuring out hoiw to make this thing run the way its suppose too

    /*var $ = function (id) {
    return document.getElementById(id);

    var calculateCelcius_click = function()
    if ($("to_celcius").checked)// checks to see if fahrenheit to celcius button is clicked
    var fahrenheit = parseFloat($("degrees_fahrenheit").value);//var to take text entered into degrees fahrenheit and make it number value
    $("degrees_celcius").diabled = true;
    if (isNaN(fahrenheit))//error check to see if user input is a number
    alert("Invalid Entry, please neter a valid number")// error message to display if anything other than numbers are entered
    else if (!isNaN(fahrenheit))// if numbver is valid do the following calculations
    var celsius = (fahrenheit - 32) * 5/9;
    celsius = parseInt(celsius);
    $("degrees_celcius").value = celsius;

    var calculateFahrenheit_click = function()
    if ($("to_fahrenheit").checked)// checks to see if celcius to fahrenheit button is clicked
    var celcius = parseFloat($("degrees_celcius").value);//var to take text entered into degrees fahrenheit and make it number value
    $("degrees_fahrenheit").diabled = true;
    if (isNaN(celcius))//error check to see if user input is a number
    alert("Invalid Entry, please neter a valid number")// error message to display if anything other than numbers are entered
    else if (!isNaN(celcius))// if numbver is valid do the following calculations
    var fahrenheit = celcius * 9/5 + 32;
    fahrenheit = parseInt(fahrenheit);
    $("degrees_fahrenheit").value = fahrenheit;

    window.onload = function ()
    $("convert").onclick = calculateCelcius_click;
    $("convert").onclick = calculateFahrenheit_click;


    like i said its incomplete and im just getting frustrated because im using my text book to figure things out and its not much help when you feel like your teaching yourself and dont know where to start....im sure this a simple temperature converter for some of you but being as green as i am any help with this thing would be greatly appreciated..

  2. #2
    Join Date
    Dec 2005
    Now, for future reference, try not to double post.
    See: http://www.webdeveloper.com/forum/sh...d.php?t=257914

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.13387 seconds
  • Memory Usage 2,853KB
  • Queries Executed 15 (?)
More Information
Template Usage (32):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates