Michael G's Blog

What’s going on below?

Posted in Uncategorized by michaelg1980 on February 16, 2010

The code:

<!DOCTYPE html PUBLIC “_//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=”Content-Type” content=”text/html; hcarset=UTF-8 />
<title>Untitled Document</title>
<style type=”text/css”>
.urgent {
color : red;
font-weight : bold;
font-size : 20pt;
}
.notsourgent {
color : blue;
font-weight : normal;
font-size : 70%;
}
</style>
<script type=”text/javacript”>
function makeLessUrgent() {
document.getElementByID(“urgentmessage”).classname=”notsourgent”;
} This javscript defines a function named “makeLessUrgent.” It looks for an element id “urgentmessage” and replaces its style with the class “notsourgent” defined in the head above.
</script>
</head>
<body>
<div class=”urgent” id=”urgentmessage”>THIS IS URGENT!</div>
<br />
<input type=button id=”msgbtn” size=”20” value=”Dealt with”
onclick=”makeLessUrgent();” /> Here the function “makeLessUrgent” gets actived “onclick” by the button.
</body>
</html>

Link to my non-working javascript homework. Yay!

Advertisements

One Response

Subscribe to comments with RSS.

  1. Gina said, on February 22, 2010 at 4:20 pm

    You’re going to be so mad when I tell you why your script isn’t working.
    In your Test function, you need to capitalize the “B” in getElementById.

    Then it should work. 😀


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: