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
Printable View
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
it should be possible, what are you trying to do?
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.
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')">
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:
cwpage1.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>
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>
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