Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to change radio buttons into drop down.

Posted on 2002-03-14
10
Medium Priority
?
144 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
[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
  • 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 100 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

636 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