Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript

  • 08-09-2002 6:46pm
    #1
    Registered Users, Registered Users 2 Posts: 605 ✭✭✭


    Hey,
    sorry if this is in the wrong place 1st of all, I'm just wondering if someone could give me a javascript that takes in 2 numbers (both from text field boxes) and on the press of a submit button does the action (#1 * #2 / 675) and displays the result in another text field box.
    I tried looking around for similer ones which I could edit around, but I have no clue about jscript.

    Thanks a million
    - Tim


Comments

  • Closed Accounts Posts: 154 ✭✭mofu


    Why would I wanna help you if you hate Ireland? As it says on ur site!!!!!! Personally Im not helping:mad:


  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭exiztone


    Originally posted by mofu
    Why would I wanna help you if you hate Ireland? As it says on ur site!!!!!! Personally Im not helping:mad:

    The country isnt my favourite place at all, why wont you help me for that fact? If I said I love Ireland, I'd be a liar.


  • Closed Accounts Posts: 3,322 ✭✭✭Repli


    try some thing like..
    [code]
    <script language="javascript">
    var number1 = prompt ('Enter the 1st number', ' ');
    var number2 = prompt ('Enter the 2nd number', ' ');

    var result = ((number1 * number2) / 675);
    document.write ("The result is" + result + "!!");
    </script>


  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭exiztone


    Originally posted by Repli
    try some thing like..
    [code]
    <script language="javascript">
    var number1 = prompt ('Enter the 1st number', ' ');
    var number2 = prompt ('Enter the 2nd number', ' ');

    var result = ((number1 * number2) / 675);
    document.write ("The result is" + result + "!!");
    </script>
    Hey thanks :)
    But urm, wouldn't that display prompt windows for the numbers, I gotta have this in clean text input boxes :(


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by exiztone
    The country isnt my favourite place at all, why wont you help me for that fact? If I said I love Ireland, I'd be a liar.
    Grow up. Bet your parents don't understand you either.

    Anyhow here's your code, boy:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    	function foobar(theform) {
    		theform.Answer.value = (theform.Number1.value * theform.Number2.value) / 675;
    	}
    //-->
    </SCRIPT>
    
    <FORM NAME="whatever">
    	<INPUT TYPE="text" NAME="Number1">
    	<INPUT TYPE="text" NAME="Number2">
    	<INPUT TYPE="text" NAME="Answer">
    	<INPUT TYPE="button" onclick="foobar(whatever);">
    </FORM>
    


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭exiztone


    Originally posted by The Corinthian

    Grow up. Bet your parents don't understand you either.

    Anyhow here's your code, boy:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    	function foobar(theform) {
    		theform.Answer.value = (theform.Number1.value * theform.Number2.value) / 675;
    	}
    //-->
    </SCRIPT>
    
    <FORM NAME="whatever">
    	<INPUT TYPE="text" NAME="Number1">
    	<INPUT TYPE="text" NAME="Number2">
    	<INPUT TYPE="text" NAME="Answer">
    	<INPUT TYPE="button" onclick="foobar(whatever);">
    </FORM>
    

    hey thanks a mill :)


  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭exiztone


    Damn :(
    I hate keep asking things from yah, but is it possible to have the result rounded down to 3 decimal places? :(
    I'm getting huge numbers :(


  • Closed Accounts Posts: 3,322 ✭✭✭Repli


    zzzz.........
    round();


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    exiztone,

    Look it up. Work it out for yourself. Learn. People are going to help you here or anywhere else only if you give them the impression you're learning and not just looking for someone to do your work for you. No one likes freeloading Muppets.

    And the I H8 Ireland stuff doesn't help either. Why don't you walk down 5th Ave in NY with a plackard saying "9/11 - Not enough dead Yanks" and see how many people want to give you a hand?


  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭exiztone


    Originally posted by The Corinthian
    exiztone,


    And the I H8 Ireland stuff doesn't help either. Why don't you walk down 5th Ave in NY with a plackard saying "9/11 - Not enough dead Yanks" and see how many people want to give you a hand?
    I'm sorry, I don't like arguing publically, but your comparison is just WRONG.
    I was born & raised in this country, I have never liked it.
    I have an oppinion of this place I really don't think it's fair of you to say I should take it back because you happen to like this country.

    As for "freeloading" wow... I'm terribly sorry... I had browsed the net looking for other calculators which I thought I might be able to edit the command of it... I wasn't able to so I remember here being a tech support forum, I had no idea you got flamed for asking something like this... but if that's the way it is I will try somewhere else.


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by exiztone
    I have an oppinion of this place I really don't think it's fair of you to say I should take it back because you happen to like this country.
    Your opinion is of little interest to me. My comment was directed towards your naïveté in publicly posting something like that and then getting all hurt when people don’t react to it well.
    As for "freeloading" wow... I'm terribly sorry... I had browsed the net looking for other calculators which I thought I might be able to edit the command of it... I wasn't able to so I remember here being a tech support forum, I had no idea you got flamed for asking something like this... but if that's the way it is I will try somewhere else.
    Let’s get this straight: You browsed the net looking to pinch someone else’s code, couldn’t find anything so you come here to see if you could convince those here to write the code for you. The ‘tech support’ here is voluntary - I don’t see you shelling out your pocket money for our help. So you arrive here, looking for someone to write your code for you (with no interest in learning how to do so for yourself, that much is obvious), offending others with your adolescent opinions and then getting morally indignant when people prefer to flame rather than help you? Gee, I wonder why..? :rolleyes:

    Still, you’re not that bad; you remind me of when I was young and stupid. All I’m trying to say is: Learn to be diplomatic when you want something from people.

    That’s all. Now go do your own homework.


Advertisement