placing text

Discussion in 'Javascript' started by Philip WATTS, Jul 15, 2003.

  1. Philip WATTS

    Philip WATTS Guest

    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>
    Philip WATTS, Jul 15, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stu
    Replies:
    4
    Views:
    473
  2. Luigi Donatello Asero

    Placing photo and text with CSS.

    Luigi Donatello Asero, Jan 6, 2004, in forum: HTML
    Replies:
    1
    Views:
    415
    Spartanicus
    Jan 6, 2004
  3. James Smith

    Placing of Pictures next to text.

    James Smith, Aug 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    4,258
    Luigi Donatello Asero
    Aug 12, 2004
  4. Jerry Manner
    Replies:
    5
    Views:
    545
    Jonathan N. Little
    Jun 9, 2005
  5. bart
    Replies:
    1
    Views:
    270
    Irmen de Jong
    Jul 1, 2003
Loading...

Share This Page