Click to See Complete Forum and Search --> : variable as a hyperlink


paul_mat
February 12th, 2006, 09:48 PM
hi there,

this is my code at the moment

<html>

<head>
<title>Your School</title>
<STYLE>
A {behavior: url(#default#AnchorClick);}
</STYLE>

</head>

<body>

<p>
Your School:<br>
<select size="1" name="server">
<option value="http://your1_server.com" selected>Middle</option>
<option value="http://your2_server.com">Senior</option>
<option value="http://your3_server.com">Junior</option>
</select>
</p>
<p>
<input type="radio" value="/staff/" name="group">Staff<br>
<input type="radio" CHECKED value="/students/" name="group">Student
</p>
<p>
Username:<br>
<input size="10" name="username"><br>

</body>

</html>



now at the bottom of the page i want a button that will be a link to the following variables

like if middle was selected with students and the username jack then the link would go to

http://your2_server.com/students/jack

if that makes sense?

PeejAvery
February 13th, 2006, 12:04 AM
All it takes is a form and a little JavaScript.

<html>
<head>
<title>Your School</title>
<style>
A {behavior: url(#default#AnchorClick);}
</style>
</head>
<body>

<p>
<form name="gotourl">
Your School:<br>
<select size="1" name="server">
<option value="http://your1_server.com" selected>Middle</option>
<option value="http://your2_server.com">Senior</option>
<option value="http://your3_server.com">Junior</option>
</select>
</p>
<p>
<input type="radio" value="staff" name="group">Staff<br>
<input type="radio" CHECKED value="students" name="group">Student
</p>
<p>
Username:<br>
<input type="text" size="10" name="username"><br>
<input type="button" value="Go" onclick="makelink()"><br>
</form>

<script language="JavaScript">
var url;
function makelink(){
url = gotourl.server.value + "/" + gotourl.group.value + "/" + gotourl.username.value;
window.location = url;
}
</script>

</body>
</html>

paul_mat
February 13th, 2006, 11:48 PM
thank you for helping me, but it dosn't seam to get the radio box information

it sends me to

http://your1_server.com/undefined/username

i can't see why it would do that, and i make sure i have one of the radio boxes ticked everytime

PeejAvery
February 14th, 2006, 06:02 AM
i can't see why it would do that, and i make sure i have one of the radio boxes ticked everytime
Because I made a mistake. You can't just grab a value for a radio. Here is the proper code.

<html>
<head>
<title>Your School</title>
<style>
A {behavior: url(#default#AnchorClick);}
</style>
</head>
<body>

<p>
<form name="gotourl">
Your School:<br>
<select size="1" name="server">
<option value="http://your1_server.com" selected>Middle</option>
<option value="http://your2_server.com">Senior</option>
<option value="http://your3_server.com">Junior</option>
</select>
</p>
<p>
<input type="radio" value="staff" name="group">Staff<br>
<input type="radio" value="students" name="group" checked="checked">Student
</p>
<p>
Username:<br>
<input type="text" size="10" name="username"><br>
<input type="button" value="Go" onclick="makelink()"><br>
</form>

<script language="JavaScript">
var url;
function makelink(){
for (var i=0; i < gotourl.group.length; i++){
if (gotourl.group[i].checked){var radioval = gotourl.group[i].value;}
}
url = gotourl.server.value + "/" + radioval + "/" + gotourl.username.value;
window.location = url;
}
</script>

</body>
</html>

paul_mat
February 15th, 2006, 05:37 PM
hi,

i know you've been heaps helpful but i just need one more favour!

i need to open the links as a web folder, can you show me how to do that in javascript? or is there a way to run a HTML link via javascript?

this is how the link it setup.

<STYLE>
A {behavior: url(#default#AnchorClick);}
</STYLE>

<A HREF = "http://your_server.com/your_directory/your_file.htm"
FOLDER = "http://your_server.com/your_directory/"
TARGET = "_top"
>
Open in Web Folder View
</A>

paul_mat
February 15th, 2006, 07:38 PM
i found that on this website

http://msdn.microsoft.com/workshop/author/behaviors/overview/webfolder.asp

this is how i have edited your page to work the way i wanted it to work, but it's not working

<html>
<head>
<title>Your School</title>
<STYLE>
.httpFolder {behavior: url(#default#httpFolder);}
</STYLE>
</head>
<body>

<DIV ID="oDAV" CLASS="httpFolder" />

<p>
<form name="gotourl">
Your School:<br>
<select size="1" name="server">
<option value="https://junior.cathedral.qld.edu.au" selected>Middle</option>
<option value="https://senior.cathedral.qld.edu.au">Senior</option>
<option value="https://junior.cathedral.qld.edu.au">Junior</option>
</select>
</p>
<p>
<input type="radio" value="staff" name="group">Staff<br>
<input type="radio" value="students" name="group" checked="checked">Student
</p>
<p>
Username:<br>
<input type="text" size="10" name="username"><br>
<input type="button" value="Go" onclick="makelink()" onclick="fnOpenFolderView()"><br>
</form>



<script language="JavaScript">
var url;
function makelink(){
for (var i=0; i < gotourl.group.length; i++){
if (gotourl.group[i].checked){var radioval = gotourl.group[i].value;}
}
url = gotourl.server.value + "/" + radioval + "/" + gotourl.username.value;
oDAV.navigateFrame("url","_blank");
}

</script>
</BODY>
</HTML>

PeejAvery
February 15th, 2006, 11:02 PM
That is because you are using navigateFrame to try to change a DIV box. A DIV box is not a frame. Are you just trying to get it to open in the same window? A popup? A new blank window?