Solved

Need to change radio buttons into drop down.

Posted on 2002-03-14
10
139 Views
Last Modified: 2010-04-09
<html>
<head>
<script>
function tryagain(){
  var blankCheck = /^ *$/;  
  var obj = document.frm;
  var drive;
  for(var i=0;i<obj.length;i++){
    if(obj.elements[i].type=="radio" && obj.elements[i].checked)
      drive = obj.elements[i].value;  
  }
  var path = 'file:///'+drive+'|/windows/history';
  if(!blankCheck.test(obj.user.value)){
    path = 'file:///'+drive+'|/windows/profiles/'+obj.user.value+'/history'
  }
     window.open(path);
}
</script>
</head>
<body>
<form name="frm">
Drive:
<input type="radio" name="drive1" value="C" CHECKED>C
<input type="radio" name="drive1" value="D">D
<input type="radio" name="drive1" value="E">E
<br>User:
<input type="text" name="user">
<input type="button" onclick="tryagain();"  value="Try again">
</form>
</body>
</html>
0
Comment
Question by:forkush
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 18

Expert Comment

by:bruno
ID: 6867508
<input type="radio" name="drive1" value="C" CHECKED>C
<input type="radio" name="drive1" value="D">D
<input type="radio" name="drive1" value="E">E



<select name="drive1">
<option value="C" selected="selected">C</option>
<option value="D">D</option>
<option value="E">E</option>
</select>
0
 

Author Comment

by:forkush
ID: 6867523
brunobear:
Thanks, but it didn't work.
The form did not function properly, as it did before.  The variable drive1 was not handled correctly in the result.
0
 
LVL 30

Accepted Solution

by:
third earned 25 total points
ID: 6867527
here i modified for you,

<html>
<head>
<script>

  function tryagain(){
    var blankCheck = /^ *$/;  
    var obj = document.frm;
    var drive;
    drive = obj.drive1.value;  

    var path = 'file:///'+drive+'|/windows/history';
    if(!blankCheck.test(obj.user.value)){
      path = 'file:///'+drive+'|/windows/profiles/'+obj.user.value+'/history'
    }
    alert(path);
    window.open(path);
  }

  function changestyle(){
    document.all['text'].style.background = '#000000';
  }
</script>
</head>
<body>
<form name="frm">
  Drive:
  <select name="drive1">
    <option value="C">C</option>
    <option value="D">D</option>
    <option value="E">E</option>
  </select>
  <br>User:
  <input type="text" id="text" name="user">
  <input type="button" onclick="tryagain();"  value="Try again">
</form>
</body>
</html>
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 30

Expert Comment

by:third
ID: 6867596
ill clean up the mess i have made,

function tryagain(){
   var blankCheck = /^ *$/;  
   var obj   = document.frm;
   var drive = obj.drive1.value;  
   var user  = obj.user.value;  
   var path = 'file:///'+drive+'|/windows/history';
   if(!blankCheck.test(user)){
     path = 'file:///'+drive+'|/windows/profiles/'+user+'/history'
   }
   alert(path);
   window.open(path);
 }

 
also, ignore the changestyle function. it didn't know i mixed the code together with the project im working on. anything else im missing?
0
 
LVL 18

Expert Comment

by:bruno
ID: 6868322
forkush,

well you did not really specify what you needed, all I had to go on was your subject line.


BRUNO
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 6868589
BrunoBear,

I couldn't help but notice how Experts' time is wasted as a result of poorly formulated questions, or questions that lead to an endless stream of other questions and etc. I wonder if we should post a message to community support so that the guidelines are updated in such a way to encourage those who ask questions to do so in a thoughtful, careful manner.

I have learned from experience that if I take an extra five minutes to formulate my questions, I get targeted, specific answers that really help me.

Of course, that's just my two cent's worth...

Fritz the Blank
0
 
LVL 18

Expert Comment

by:bruno
ID: 6868702
Fritz,

Agreed, but I don't know that different guidelines would really help.  

Certain people will post very targeted questions, certain won't.

More or less here I was playing devils advocate.  I'm not that great with javascript, so I didn't even try to touch it.  I knew the form would not work the way the user wanted to, but I just wanted to make a point that according to what they left, that's what I gave them.  :-)  If I thought I could have updated the script as well, I probably would have.


BRUNO
0
 

Author Comment

by:forkush
ID: 6868776
Fritz and Brunobear,
I apologize for my inexact question.  I'll try to do better next time.  I've asked 25 questions here, and it's only the second or third time I've received a "What a dumb question," response.  That's not too bad, is it?

If you read http://www.pbs.org/cringely/pulpit/pulpit20020314.html , you'll find that my claim to fame is that I don't know what I'm doing, I just "rely on the kindness of strangers" to do much of the work.  Now I'm being told I don't even know how to ask the questions!
0
 

Author Comment

by:forkush
ID: 6868781
This comment, combined with Third's follow-up comment, does the trick.
0
 
LVL 18

Expert Comment

by:bruno
ID: 6868789
>>it's only the second or third time I've received a "What a dumb question," response.  

lol....it is not so much that is was dumb, as there really was not a question posed except what was in the subject line.  As I said, even if the question had been better, I still couldn't have done more....

:-)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
insert text field data into html script 13 43
How can I convert HTML files to .pdf files? 9 57
HTML5 Get data in table rows 5 29
If condition on Html with Asp 11 18
Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

831 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