Please can someone help me. This is my first javascript and i really need help

Discussion in 'JavaScript' started by Majo Rawne, May 15, 2007.

  1. #1
    Please can someone cut this, correct it in notepad and paste it back in a reply im desperate its for some work im doing and im running out of time....

    <HTML>
    <HEAD>
    <TITLE>
    Deliver Charges
    </TITLE>
    <SCRIPT LANGUAGE = "JavaScript">

    // A delivery charge program

    var orderValue; // How much the order is worth

    orderValue = window.prompt('How much is the order worth in Pounds Sterling?','');

    document.write('The value of your order is £' + orderValue + '.<BR>');
    orderValue = parseFloat(orderValue);
    if (orderValue <= 24.99)
    {
    document.write('Your Charge For Delivery Is £3')
    }
    else
    {
    if (orderValue 25<=99.99)
    {
    document.write('Your Delivery Is Free Of Charge')
    }
    else
    {
    if (orderValue 100 >)
    {
    document.write('Your Deliver Is Free And Comes With A Complimentry Gift Vocher')
    }
    }
    }

    document.write('<BR>');
    document.write('Thank you for shopping with us.');

    </SCRIPT>
    </HEAD>
    <BODY>
    </BODY>
    </HTML>
     
    Majo Rawne, May 15, 2007 IP
  2. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Hello Majo, and welcome!
    Here you have it... :)

    <script type="text/javascript">
    
    // A delivery charge program
    var orderValue; // How much the order is worth
    
    	orderValue = parseFloat(orderValue);
    
    	orderValue = window.prompt('How much is the order worth in Pounds Sterling?', '23');
    
    	if ( orderValue <= 24.99 )  {
    	
    	document.write('Your Charge For Delivery Is £3');
    	
      	}
      
    	else if ( orderValue <= 99.99 )  {
    	
    	document.write('Your Delivery Is Free Of Charge');
    	
      	}
    
    	else if ( orderValue < 100 )  {
    		
    	document.write('Your Deliver Is Free And Comes With A Complimentry Gift Vocher');
    	
    	}
    	
    	document.write('The value of your order is £' + orderValue + '.<BR>');
    	document.write('<BR>');
    	document.write('Thank you for shopping with us.');
    	
    </script>
    Code (markup):
     
    wing, May 15, 2007 IP
  3. Majo Rawne

    Majo Rawne Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you so much for you help mate but theres just one more bit of help i need when i put in a value for example 56 i get this come up

    Your Delivery Is Free Of ChargeThe value of your order is £56.

    Thank you for shopping with us

    which is correct mate dont get me wrong but where do i insert the <BR> tag to make "The Value of your order is £56" appear on a seperate line
     
    Majo Rawne, May 15, 2007 IP
  4. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Just add your linbreaks or anything else like this:

    document.write('<br>The value of your order is £' + orderValue + '.<br>');

    :)
     
    wing, May 15, 2007 IP