Solved

DHTML JSCRIPT string selection

Posted on 1998-11-18
1
134 Views
Last Modified: 2010-04-09
How does the following code "ChangeMe()" select strings? First the first string then the second when the client clicks their mouse ? There's no i++ index to tell the JScript is it just a sequential order....

//////////////// CODE /////////////////////////
<HEAD><TITLE>Welcome!</TITLE>
<SCRIPT LANGUAGE="JScript">
function changeMe() {
    document.all.MyHeading.style.color = "green";
    document.all.MyText.innerText = "You can do the most amazing things with the least bit of effort.";
}
</SCRIPT>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="all">
</HEAD>
<BODY TOPMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#808080" ALINK="#000000" onclick="changeMe()">

<H3 ID=MyHeading>Welcome to Dynamic HTML!</H3>
<P ID=MyText>Click anywhere in this document.</P>
</BODY>
////////////// END ////////////////////////

0
Comment
Question by:optical
1 Comment
 
LVL 1

Accepted Solution

by:
rajgn earned 50 total points
ID: 1839871
You can observe ID attribute in <H3> and <P> tags. This attribute sets the ID(like a name) for that particular tag. And in changeMe() these tags are referred by saying,

document.all.MyHeading
document.all.MyText

by setting style.color, innerText properties of these tags you can see the required effect.
Great! isn't it?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now