Solved

need the syntax to input a user id as a variable

Posted on 2004-08-28
8
146 Views
Last Modified: 2011-09-20
Hi,

I have some code that will allow me to open a webdav folder on a remote server.  I an addition to the code to allow users to enter their user id.  That userid will then be pushed into the path for the webdav folder and open the website.  Here is the code:

<HTML>
<HEAD>
<STYLE>
A {behavior: url(#default#AnchorClick);}
</STYLE>
</HEAD>
<BODY onload="document.all.GoWebFolder.click()">
<A ID="GoWebFolder" HREF="http://12.34.56.78"
FOLDER="http://www.homedrive.net">
Opening Web Folder...
</A>
</BODY>
</HTML>

I would like to be able to prompt for a userid as a variable and then push that variable the end of "http://www.homedrive.net/userid".  Userid would be the user's id.  I realize this would be a piece of cake for you guys, but I'm not a programmer.  Any help would be appreciated.

thanks

John Bond
0
Comment
Question by:ssgtbond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 21

Expert Comment

by:MogalManic
ID: 11924039
Something like this:

<html>
<head>
<title>Enter userID and click OK</title>
</head>
0
 
LVL 21

Accepted Solution

by:
MogalManic earned 150 total points
ID: 11924049
Sorry 2nd try:
<html>
  <head>
    <title>Enter userID and click OK</title>
    <script type='text/javascript'>
function submitID()
{
   login.action="http://www.homedrive.net/"+login.userID.value;
   return true;
}
    </script>
  </head>
  <body>
    <form name='login'>
      <input type='text' name='userID'> <input type='submit' name=
      'OK' value='OK'  onclick='submitID()'>
    </form>
  </body>
</html>
0
 

Author Comment

by:ssgtbond
ID: 11924115
You're on the right track, but it still has to be a webfolder or webdav login.  About the only thing I've seen that would work with it is the "folder = " line.  by the way, it's https, sorry my fault in case you tried to get to the web site.  Thanks for the quick response.  Any other ideas?

jb
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 21

Expert Comment

by:MogalManic
ID: 11924376
You should be able to change the URL to any valid URL and it should work.  

You can also add some validation on the function and return false if the user name does not conform to some pattern.
0
 
LVL 19

Assisted Solution

by:dakyd
dakyd earned 150 total points
ID: 11926118
Is this more like what you want?  It uses a bit of javascript to show a userID prompt, instead of using a text field.  I did that because it looks like you want to go to this folder on loading the page.  So to keep that behavior intact, I used a prompt instead.  Hope that helps.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<style>
A {behavior: url(#default#AnchorClick);}
</style>
<script type="text/javascript">
window.onload = init;

function init()
{
  var theFolder = prompt("Please enter your user ID");
  var obj = document.getElementById("GoWebFolder");
  var pieces = obj.parentNode.innerHTML.split("folder=\"http://www.homedrive.net\"");
  obj.parentNode.innerHTML = pieces.join("folder=\"http://www.homedrive.net/" + theFolder + "\"");
  obj.click();
}
</script>
</head>
<body>
<a id="GoWebFolder" href="http://12.34.56.78"
folder="http://www.homedrive.net">
Opening Web Folder...
</a>
</body>
</html>
0
 

Author Comment

by:ssgtbond
ID: 12047747
I'll try it this weekend.  I'll give you the credit either way, and let you know.  thanks for the help.

jb
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question