Help with class assignment
-
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
-
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
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.
-
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
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
-
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
-
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
Thank you so much. a push the right way was exactly what I was asking for.
-
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
Thank you. That was very helpful.