Results 1 to 6 of 6

Thread: Variable in a Hyperlink

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    3

    Question

    Does anyone know if it is possible to use a variable to place the URL into a hyperlink. Or is there a better way?

    Thanks
    Craig

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    it should be possible, what are you trying to do?
    Mark
    -------------------

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    3
    I have a page with two frames. the main frame contains a body of text. This frame also contains a line of code giving the variable the name of the next file to be loaded. The second frame contains a navigation set of buttons. I want the 'next' button for example to use the variable value as the hyperlinks and load it it the 'main' frame.

    Each page that load into the main frame would contain a line with a new value for the variable.

  4. #4
    Guest
    This what you want?

    Code:
    <SCRIPT LANGUAGE="JavaScript">
     function change(newDes)  {
    	  window.location=newDes
    }
    </SCRIPT>
    <input type="button" value="Click" onClick="change('http://www.vb-world.net')">

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    is this the sort of thing that you require?


    frames page:
    Code:
    <HTML>
    <frameset cols="100,*">
    	<frame name="left" src="./cwleft.html">
    	<frame name="main" src="./cwpage1.html">
    </frameset>
    
    </HTML>

    cwleft.html:
    Code:
    <HTML>
    <HEAD>
    <script language=javascript>
    
    function doit()
    {
    parent.main.location=parent.main.nextPage;
    
    }
    </script>
    
    
    
    </HEAD>
    <BODY>
    
    <form>
    <input type="button" value="next" onClick="doit()">
    </form>
    </BODY>
    </HTML>
    cwpage1.html:
    Code:
    <HTML>
    <HEAD>
    <script language=javascript>
    
    var nextPage="./cwpage2.html";
    </script>
    </HEAD>
    <BODY>
    
    <h4> this is page1 </h4>
    </BODY>
    </HTML>


    cwpage2.html:
    Code:
    <HTML>
    <HEAD>
    <script language=javascript>
    
    var nextPage="./cwpage1.html";
    </script>
    </HEAD>
    <BODY>
    
    <h4> this is page2 </h4>
    </BODY>
    </HTML>
    Mark
    -------------------

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    3

    Wink

    Thank you very much for that. I didn't even think about going down the form route. Daft really.

    Thanks again it works a treat.

    Craig

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width