placing text

P

Philip WATTS

Can anyone help a beginner?
I am trying to set up a situation where by activating a link, a text phrase
above the link changes.
I am calling a function that uses a document.write statement, but the text
is shown in a new window (replacing the current one) rather than on the same
page.
The code is below.

Thanks for your time

Phil

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
text=new String
start=new String
one=new String
two=new String
text="initial text value"

function phase1(){
text="phase one text from function"
document.write(text)
}
function phase2(text){
text="phase two text from function"
document.write(text)
}
</script>
</head>
<body>
<div name="texthere"> Text is supposed to go here</div>
<script language="Javascript">
document.write(text)
</script>

<a href="java1.html#" onClick="phase1()">link1</a>
<a href="java1.html#"onClick="phase2()">link2</a>


</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top