Javascript Worksheet

Description

Hide Assignment Information

1. Lab

Script 1:

This script tests the users browser to see which one they are using. Adapt this script to do two other things:

1. If the browser is Chrome, alert “Ah ha, I see that you are using Chrome”

2. Also test to see if the user is using Mac, Windows, or something else.

<script>

var browser = navigator.userAgent;

console.log(browser)

if (browser.indexOf(“Firefox”) > -1) {

alert(“Ah ha, you’re using Firefox!”);

}

</script>


Script 2:

This script checks to see if the user mouses over the Header text, and if they do, it changes the text that they see on the screen. Add to this script two new HTML elements, like an <A href or an <IMG (or any other block level element), and a block of text wrapped in a <P>. Attach an “onClick” method to the first tag, so that when it is clicked, the text inside the <P> tag changes.

<html>

<head>

<title>My page</title>

</head>

<body>

<script>

function changeIt() {

document.getElementById(“header”).innerHTML=”This is the new header text”;

}

</script>

<h1 id=”header” onMouseOver=”changeIt();”>This is the header</h1>

<p>This is the body text</p>

</body>

</html>


2. FORUM:

In the groups where you discussed the four pillars of OOP, I have placed a video. After you watch the video, consider how the creator of the video uses one metaphor throughout the whole video to explain the concepts.

Review what each member contributed to the discussion last time, identify any missing parts (like a missing pillar, for example), and then together, decide on one metaphor that you can use to explain all of the concepts. Create a final post that offers this one, complete metaphor in the group discussion board called “SESSION 12: OOP Explanation”


Get your college paper done by experts

Do my question How much will it cost?

Place an order in 3 easy steps. Takes less than 5 mins.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *