Question

2. Write a JavaScript to create a. Alert Dialog Box b. Confirmation Dialog Box c. Prompt...

2. Write a JavaScript to create

a. Alert Dialog Box

b. Confirmation Dialog Box

c. Prompt Dialog box

3. Write a JavaScript to Change an image when a user holds down the mouse button.

4. Write a JavaScript to display all the cookies set on your machine.

5. Write a JavaScript to disable right click on the page

0 0
Add a comment Improve this question Transcribed image text
Answer #1

3.

CODE

<!DOCTYPE html>
<html>
<head>
<script>
function lighton() {
document.getElementById('myimage').src = "bulbon.gif";
}
function lightoff() {
document.getElementById('myimage').src = "bulboff.gif";
}
</script>
</head>

<body>

<img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="bulboff.gif" width="100" height="180" />

<p>Click mouse and hold down!</p>

</body>
</html>

4.

CODE

function get_cookies_array() {

    var cookies = { };

    if (document.cookie && document.cookie != '') {
        var split = document.cookie.split(';');
        for (var i = 0; i < split.length; i++) {
            var name_value = split[i].split("=");
            name_value[0] = name_value[0].replace(/^ /, '');
            cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
        }
    }

    return cookies;
   
}
var cookies = get_cookies_array();
for(var name in cookies) {
  document.write( name + " : " + cookies[name] + "<br />" );
}

NOTE: As per Chegg policy, I am allowed to answer only 2 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
2. Write a JavaScript to create a. Alert Dialog Box b. Confirmation Dialog Box c. Prompt...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create an external JavaScript file/code and then write a function that displays an alert box. This...

    Create an external JavaScript file/code and then write a function that displays an alert box. This box will display when the user clicks the submit button to submit the information typed in the form, so be sure the alert box contains an appropriate message. please use the OnClick event handler for your form's submit button.

  • Please write in JAVA ONLY Please use a dialog box to prompt the user to enter...

    Please write in JAVA ONLY Please use a dialog box to prompt the user to enter the radius for a circle (radius should be a double). Then, use a Message Box to display the Radius, Area and Circumference of the circle with that Radius. You will use the Math class constant Math.PI to calculate the Area and Circumference.

  • ***JAVASCRIPT*** I need JAVASCRIPT codes for this question. Also a little explanation and full screenshots of...

    ***JAVASCRIPT*** I need JAVASCRIPT codes for this question. Also a little explanation and full screenshots of the codes. Short 6-1 Upgrade the MPG application In this exercise, you'll upgrade a version of the MPG application so the error messages are displayed in span elements to the right of the text boxes. Estimated time: 10 to 15 minutes. Calculate Miles Per Gallon Miles Driven Mies must be numeric and greater than zero Gallons of Gas Used Gallons must be numeric and...

  • given below are the project description and their Html and css files i need javascript according to the project and other files!

    HTML------------------------------------------------------CSS---------------------------------------------------WEB230 - JavaScript 1 Assignment 7 - FormsSome of these tasks would be better done in HTML or CSS but do them in JavaScript to practice whatwe have learned.1. Select the form element and save it in a variable. From here we can access all of the form fields.2. When the page loads do the following:add the password value "monkey"select the favourite city "New York"clear the textarea3. Add an event handler to the "name" field to change the background color...

  • for Javascript, JQuery When the page is first opened a user will see the name field...

    for Javascript, JQuery When the page is first opened a user will see the name field and the three vacation images to the left of the page. The page should behave according to the following rules. 1. When a user's mouse pointer goes over any image, that image's border will change to be "outset 10px" and when the mouse pointer leaves that image it's border will change to "none". 2. When the user clicks a "Vacation" image on the left,...

  • Homework 8   Re-write this code using a style sheet not in-line styles <html> <head><title>position</title> </head> <body>...

    Homework 8   Re-write this code using a style sheet not in-line styles <html> <head><title>position</title> </head> <body> <img src= "snow.jpg" style="positon: absolute; top:0px; left: 0px; z-index: 1"> <img src="nagano_1.jpg" Style = "position: absolute; top:70px; left: 150px; z-index:2"> <h1 style= "position: fixed; top:50px; left: 50px; color:2338ee; z-index:3";> this is a test of position</h1> </body></html> 1. Create an HTML file that uses an alert dialog box to display the message "Hi There!" when the page loads 2. Create an HTML file that creates...

  • javascript

    In this project you will write the JavaScript code to create a calculator. Good thing is that everyone knows how the calculator works. It is a challenging project, give yourself lots of time to complete it.1. You are provided with an HTML, and CSS files.. Look at these files to understandhow to use them and modify them if needed based on your code. (Note: You can adddifferent selector (id, class) in HTML ONLY and cannot make any changes to CSS.)Create...

  • Need help on following Java GUI problem: Write a program that lets a user display and...

    Need help on following Java GUI problem: Write a program that lets a user display and modify pictures. Create a window. Add four buttons so that clicking a particular button will shift the image by a small amount in the north, south, east or west direction inside the window. Add a menu bar with two menus: File and Image. The File menu should contain an Open menu item that the user can select to display JPEG and PNG files from...

  • Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt...

    Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt with good data and after invalid data Input OK Cancel Input dialog boxes with sample input for Property 1 Ingut X Input Enter the address for Property 1 Enter the value of Property 1: OK Cancel Input dialog boxes after invalid data entered for Property 1 Error Please enter anmumber greater than D Ester the walue of Peoperty t Console output END SALES REPORT...

  • abe 2 Use the provided HTML for the following questions. You only need to write the...

    abe 2 Use the provided HTML for the following questions. You only need to write the JavaScript code for the following questions. No need to write a full JavaScript application. Ex. if I said "Set a myVar variable equal to 2" you would simply write myVar = 2; Please write your code in a separate file. The file MUST be named with the following format lastname_firstname.js. Use comments to divide the questions on the single JavaScript file. Example, for question...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT