JavaScript help please! :)

Discussion in 'Web Design and Development' started by uzit, May 10, 2009.

  1. uzit macrumors regular

    Joined:
    May 15, 2008
    #1
    I cannot seem to separate the 'firstWord' and 'secondWord'!
    <HTML>
    <HEAD>
    <TITLE>Krazy Phrases</TITLE>
    <SCRIPT LANGUAGE = "JavaScript">

    var firstWord;
    var secondWord;
    var thirdWord;

    firstWord = window.prompt('Please enter your first word','');
    secondWord = window.prompt('Please enter your second world','');
    thirdWord = window.prompt('Please enter your third world','');
    document.write('The '+ firstWord + secondWord + 'the '+ thirdWord);


    </SCRIPT>

    </HEAD>

    <BODY>
    </BODY>
    </HTML

    anyone help? deadline is 2morrow

    Thanks!
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Like so?
    PHP:
    document.write('The 'firstWord +' 'secondWord 'the 'thirdWord);
    If not, you'll need to elaborate.
     
  3. uzit thread starter macrumors regular

    Joined:
    May 15, 2008
    #3
    That has made space between the firstWord and SecondWord but the the word 'tickles' is right next to the.

    Heres the picture!
     
  4. uzit thread starter macrumors regular

    Joined:
    May 15, 2008
    #4
    Anyways, I managed to get it right - JavaScript is new for me so I am still learning, this is for one my assignments for University.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Glad you got it. Just needed that space before the string with "the" in it. I missed that my first glance over it.
     
  6. uzit thread starter macrumors regular

    Joined:
    May 15, 2008
    #6
    thank you mate :)

    mods can close the thread if they want!
     

Share This Page