Link to home
Start Free TrialLog in
Avatar of forkush
forkush

asked on

Need to change radio buttons into drop down.

<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>
Avatar of bruno
bruno
Flag of United States of America image

<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>
Avatar of forkush
forkush

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of third
third
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
forkush,

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


BRUNO
Avatar of fritz_the_blank
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
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
Avatar of forkush

ASKER

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!
Avatar of forkush

ASKER

This comment, combined with Third's follow-up comment, does the trick.
>>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....

:-)