PDA

Click to See Complete Forum and Search --> : Variable in a Hyperlink


cworcest
Nov 15th, 2000, 10:20 AM
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

Mark Sreeves
Nov 15th, 2000, 02:00 PM
it should be possible, what are you trying to do?

cworcest
Nov 15th, 2000, 05:08 PM
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.

Nov 15th, 2000, 09:50 PM
This what you want?

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

Mark Sreeves
Nov 16th, 2000, 02:32 AM
is this the sort of thing that you require?


frames page:

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

</HTML>





cwleft.html:

<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:

<HTML>
<HEAD>
<script language=javascript>

var nextPage="./cwpage2.html";
</script>
</HEAD>
<BODY>

<h4> this is page1 </h4>
</BODY>
</HTML>







cwpage2.html:

<HTML>
<HEAD>
<script language=javascript>

var nextPage="./cwpage1.html";
</script>
</HEAD>
<BODY>

<h4> this is page2 </h4>
</BODY>
</HTML>

cworcest
Nov 16th, 2000, 04:35 AM
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