Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Help with class assignment

Help with class assignment

Scheduled Pinned Locked Moved JavaScript
javascripthtmltoolshelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GeraldBlackmore
    wrote on last edited by
    #1

    I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.

    <html>
    <head>
    <title>Invitation</title>
    <meta charset="utf-8">

    </head>

    <body>

    <p id="salutation">
    </p>
    <p id="image"></p>
    <p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
    </p>
    <p>Sincerely,</p>
    <p id="closingname"></p>

    <script type="text/javascript" src="script\letter.js"></script>
    </body>
    </html>

    And this is what I have for the .js:

    "use strict";

    function greeting() {
    var textOne = "Dear";
    var name = "John";
    var punc = ",";
    document.write(textOne + name + punc);
    }

    function complete() {
    var yourName = "Gerald Blackmore";
    var img = "<img src='image/partyimage.jpg'>";
    greeting();
    document.write(img);
    document.write(yourName);

    }

    complete();

    These are the teachers instructions: Create the following web page and name it letter.html. <html> <head> <title>Invitation</title> <meta charset="utf-8"> </head> <body>

    You are invited to my house for a Cinco de Mayo party May 5, 2014.

    Sincerely,

    </body> </html> Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site. Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file. In the external JavaScript file you are to create two functions and invoke them. The first function should: Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":". The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:". The second function should: Accept three arguments, the salutation returned by t

    P Richard DeemingR V 3 Replies Last reply
    0
    • G GeraldBlackmore

      I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.

      <html>
      <head>
      <title>Invitation</title>
      <meta charset="utf-8">

      </head>

      <body>

      <p id="salutation">
      </p>
      <p id="image"></p>
      <p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
      </p>
      <p>Sincerely,</p>
      <p id="closingname"></p>

      <script type="text/javascript" src="script\letter.js"></script>
      </body>
      </html>

      And this is what I have for the .js:

      "use strict";

      function greeting() {
      var textOne = "Dear";
      var name = "John";
      var punc = ",";
      document.write(textOne + name + punc);
      }

      function complete() {
      var yourName = "Gerald Blackmore";
      var img = "<img src='image/partyimage.jpg'>";
      greeting();
      document.write(img);
      document.write(yourName);

      }

      complete();

      These are the teachers instructions: Create the following web page and name it letter.html. <html> <head> <title>Invitation</title> <meta charset="utf-8"> </head> <body>

      You are invited to my house for a Cinco de Mayo party May 5, 2014.

      Sincerely,

      </body> </html> Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site. Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file. In the external JavaScript file you are to create two functions and invoke them. The first function should: Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":". The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:". The second function should: Accept three arguments, the salutation returned by t

      P Offline
      P Offline
      Peter Leow
      wrote on last edited by
      #2

      You have got the wrong idea. This is a forum to answer specific programming problem, not to do someone's homework/assignment. We are not helping you if we do it for you. The assignment is meant to gauge your understanding of what you have learned, if we do it for you, we get the grade, not you. How are you going to pass your test/exam subsequently,let alone graduating. Remember, no effort no gain, and study hard.

      1 Reply Last reply
      0
      • G GeraldBlackmore

        I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.

        <html>
        <head>
        <title>Invitation</title>
        <meta charset="utf-8">

        </head>

        <body>

        <p id="salutation">
        </p>
        <p id="image"></p>
        <p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
        </p>
        <p>Sincerely,</p>
        <p id="closingname"></p>

        <script type="text/javascript" src="script\letter.js"></script>
        </body>
        </html>

        And this is what I have for the .js:

        "use strict";

        function greeting() {
        var textOne = "Dear";
        var name = "John";
        var punc = ",";
        document.write(textOne + name + punc);
        }

        function complete() {
        var yourName = "Gerald Blackmore";
        var img = "<img src='image/partyimage.jpg'>";
        greeting();
        document.write(img);
        document.write(yourName);

        }

        complete();

        These are the teachers instructions: Create the following web page and name it letter.html. <html> <head> <title>Invitation</title> <meta charset="utf-8"> </head> <body>

        You are invited to my house for a Cinco de Mayo party May 5, 2014.

        Sincerely,

        </body> </html> Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site. Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file. In the external JavaScript file you are to create two functions and invoke them. The first function should: Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":". The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:". The second function should: Accept three arguments, the salutation returned by t

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        As Peter said, we're not going to do your homework for you. However, it sounds like you just need a hint to push you in the right direction. :) document.write[^] will write the string to the document at the point where the function is called. You want to insert the string into a specific element, which means you need to get that element by ID, and update its inner HTML.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        G 1 Reply Last reply
        0
        • G GeraldBlackmore

          I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.

          <html>
          <head>
          <title>Invitation</title>
          <meta charset="utf-8">

          </head>

          <body>

          <p id="salutation">
          </p>
          <p id="image"></p>
          <p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
          </p>
          <p>Sincerely,</p>
          <p id="closingname"></p>

          <script type="text/javascript" src="script\letter.js"></script>
          </body>
          </html>

          And this is what I have for the .js:

          "use strict";

          function greeting() {
          var textOne = "Dear";
          var name = "John";
          var punc = ",";
          document.write(textOne + name + punc);
          }

          function complete() {
          var yourName = "Gerald Blackmore";
          var img = "<img src='image/partyimage.jpg'>";
          greeting();
          document.write(img);
          document.write(yourName);

          }

          complete();

          These are the teachers instructions: Create the following web page and name it letter.html. <html> <head> <title>Invitation</title> <meta charset="utf-8"> </head> <body>

          You are invited to my house for a Cinco de Mayo party May 5, 2014.

          Sincerely,

          </body> </html> Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site. Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file. In the external JavaScript file you are to create two functions and invoke them. The first function should: Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":". The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:". The second function should: Accept three arguments, the salutation returned by t

          V Offline
          V Offline
          vbmike
          wrote on last edited by
          #4

          Also, your functions do not follow the instructions either. You need some arguments, not just variables within. See http://www.w3schools.com/js/js_functions.asp[^]

          vbmike

          G 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            As Peter said, we're not going to do your homework for you. However, it sounds like you just need a hint to push you in the right direction. :) document.write[^] will write the string to the document at the point where the function is called. You want to insert the string into a specific element, which means you need to get that element by ID, and update its inner HTML.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            G Offline
            G Offline
            GeraldBlackmore
            wrote on last edited by
            #5

            Thank you so much. a push the right way was exactly what I was asking for.

            1 Reply Last reply
            0
            • V vbmike

              Also, your functions do not follow the instructions either. You need some arguments, not just variables within. See http://www.w3schools.com/js/js_functions.asp[^]

              vbmike

              G Offline
              G Offline
              GeraldBlackmore
              wrote on last edited by
              #6

              Thank you. That was very helpful.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups