Jump to content

Search the Community

Showing results for tags 'option'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 11 results

  1. <table border=1 colspan=50% width = 101% bgcolor = "#00012a" size=20%> <tr><td><select name="dept" color ="#0011a1"><option value="u" selected>DEPARTMENTS <option value="ap"><a href='code1.php'><a href='code1.php'>APPLIED SCIENCE DEPATMENT</a></option> <option value="pur">PURE SCIENCE <option value="soc">SOCIAL SCIENCE <option value="hum">HUMANITY </select> </td> </table>
  2. Ok, I've been having a hard time with this thing. It seems like it should be simple but I keep running into obstacles that I just can't seem to fix. I've got a bunch of files that I want my users to be able to access. There's 2 types (articles, calendars) and each needs to be viewed in 1 of 3 formats (pdf, word, webpage). these files are monthly. So I have the following option boxes - Year, Month, Type, format. User selects and then clicks a button to get the URL link. 2 problems - 1) the extensions of the calendars are .pdf, .docx and .html whereas the article extensions are .pdf, .doc and .htm; 2) the file name format is different - calendar name format is Year Month Calendar.extension - article name is Month Article Year.extension. This is where I'm at codewise so far. <form> Select the year: <select id="myYear"> <option>2018</option> <option>2017</option> <option>2016</option> <option>2015</option> </select> <br><br> Select the month: <select id="myMonth"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> <br><br> Select Calendar or Article: <select id="myType"> <option>Article</option> <option>Calendar</option> </select> <br><br> Select PDF, Word or Webpage: <select id="myFormat"> <option>PDF</option> <option>doc</option> <option>htm</option> </select> <br><br> <input type="button" onclick="myFunction()" value="Click Me!"> <br><br> </form> <a id="myLink" href="http://www.myOrg.org/Article/HomePage.htm" target="_blank">Star Homepage and Submission</a> <script> function myFunction() { var Yrsel = document.getElementById("myYear"); var Mnthsel = document.getElementById("myMonth"); var Typesel = document.getElementById("myType"); var Formatsel = document.getElementById("myFormat"); document.getElementById("myLink").innerHTML = "Get Star"; if (Typesel.options[Typesel.value] = "Article") { document.getElementById("myLink").href = "http://www.myOrg.org/Article/" + Mnthsel.options[Mnthsel.selectedIndex].text + " " + Yrsel.options[Yrsel.selectedIndex].text + " Article " + Typesel.options[Typesel.selectedIndex].text + "." + Formatsel.options[Formatsel.selectedIndex].text; } if (Typesel.options[Typesel.value] = "Calendar") { document.getElementById("myLink").href = "http://www.myOrg.org/Article/" + Mnthsel.options[Mnthsel.selectedIndex].text + " Calendar " + Yrsel.options[Yrsel.selectedIndex].text + " " + Typesel.options[Typesel.selectedIndex].text + "." + Formatsel.options[Formatsel.selectedIndex].text; } } </script> </div> </div> It works but I would like to use value instead of Index for the extension (format) options. So I can put something like <option value="htm">Webpage - viewable in browser, not formatted for printing</option>. Of course I would use an if statement to take care of the extra letters in the extensions. However, when I try using the value in the code it doesn't work. Formatsel.options[Formatsel.value].text HELP!!! Why won't the value work? I get a URL of XXXX.undefined
  3. I have used combo boxes for years in Access and the 'select' element on an html form is similar. All of the tutorials on w3 show how to fill the 'options' with literal values, but I would like to have the options be filled from a table in a database so the user can select one. I know this is probably a cross-topic item and I have an idea of how to go about it using javascript, php and sql, but I thought I'd ask if anyone knew of a procedure which is already created for this. In Access you just enter the row source for the combo box and the options are there - is there any kind of construct to do that for a 'select' element in html? Thanks
  4. GOAL: Use one <select> element to determine the selected option of another <select> element without destroying the ability of the second <select> element to override the selection made by the first <select> element. BACKGROUND: My biggest difficulties in my attempt to achieve the above goal are: reading the value of the first <select> element's manually (not the automated) selected option. forcing the second <select> element to perform as if it were manually selected. Please consider the following two select statements and answer the following question with jQuery. <h4>The <em>from</em> Select Input Control</h4> <select id='item_podtype_exp' form='rss2_feed' name='item_podtype'> <option value='' selected='selected'>Select a type</option> --> <option value='1'>Concept</option> <option value='2'>Form and Use</option> <option value='3'>Clausal Analysis</option> <option value='4'>Linear Analysis</option> <option value='5'>Socratic Inversion</option> </select> <h4>The <em>to</em> Select Input Control</h4> <select id='itunes_podtype_exp' form='rss2_feed' name='itunes_podtype'> <option value='' selected='selected'>Select a type</option> <option value=1>Concept</option> <option value=2>Form and Use</option> <option value=3>Clausal Analysis</option> <option value=4>Linear Analysis</option> <option value=5>Socratic Inversion</option> </select> QUESTION: How does one go about achieving the above goal? Your response will hopefully answer many more questions than I have room for here. Roddy
  5. Hi i need help for change name in Option when i press button. like that code: <select id="List"> <option value="A1">Cars</option> <option value="A2">Bike</option> <option value="A3">Train</option> </select> How i change name from "Bike" to "Plane" by press button?
  6. So my goal is now to have a table list read from the database. The content of the table is supposed to be put in an <SELECT> <OPTION VALUE> form for a dropdown menu having the user select only 1 value. $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SHOW TABLES"; if (!$result = $conn->query($sql)){ die('There was an error running the query[' .$conn->error. ']'); } foreach($row = $result->fetch_assoc()){ echo "<center>"; $reeks = implode(" " , $row); // echo $reeks; // echo "<br>"; echo "</center>"; ?> <center> <form name = "inpform" method="post" action="Add-succ7.php"> <SELECT > <option value = "<?php echo $reeks; ?>" > </option> </SELECT> </center> <?php } mysqli_close($conn); ?> Do I have to do this with foreach or while? (or something else?) In the checkbox version I use while but when doing that I get a list of 8 checkboxes without any value. I see the dropdown menu is placed in the loop of while so another condition (like foreach) seems to be the first thing to think about. But what kinda solutions would you have for the script above?
  7. I am new to Javascript so please be patient. Here I have two dropdown lists each with an alert to display the list selection. My code is a duplicated adaptation of a w3schools example.Both alert messages show selections from the "keyName" list because (I assume) both alert messages use getElementsByTagName("option").if I put the variables keyN and keyT alone in the alert functions they display the expected selection index numbers. Is there a way to link 'option' to 'select id' that forces the correct list to be read? Or perhaps another way to approach the task?Thanks in advance for any advice.codeblock<!DOCTYPE html><html><body>//List#1<select id="keyName"><option value="C">C</option><option value="D">D</option><option value="E">E</option><option value="F">F</option></select>//List#2<select id="keyType"><option value="major">major</option><option value="minor">minor</option></select><button type="button" onclick="getKey()">Get Key</button> //displays C/D/E/F<button type="button" onclick="getType()">Get Type</button> //displays C/D<script>function getKey() { var keyN = document.getElementById("keyName").selectedIndex; alert(document.getElementsByTagName("option")[keyN].value);}function getType() { var keyT = document.getElementById("keyType").selectedIndex; alert(document.getElementsByTagName("option")[keyT].value);}</script></body></html>/codeblock
  8. I have been working on this problem for a while now and don’t seem to be able to find a solution and was wondering if someone could help. I have a form which is submitted and passes two form object values and saves them to a text file held on the server, this works ok. After the submit button is pushed the file is saved with the function <?--#exec cmd_argument='SaveToFile("settings.cfg","#",Overwrite)'--> I read back the contents of the file and try to set the "selectedindex" on my speedUnits and rateUnits option list, however the option lists "selectindex" does not seem to update. I use an "input" "hidden" text field to hold the contents of the text file which is read in with the function <?--#exec cmd_argument='IncludeFile("settings.cfg")'--> My main HTML and Javascript are shown below and I was hoping something could give me some pointers. The "settings.cfg" contains designUnits#3 speedUnits#0 save#Submit Query settingsFile# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR...tml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="content-type" charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/styles.css" media="screen"> <title>Siemens BW500</title> <script type="text/javascript" src="js/convert.js"></script> </head> <body> <div id="outer_wrapper"> <div id = "wrapper"> <div id = "banner"> <h1>BW500</h1> </div> <div id ="logo"> <img src="images/logo_siemens.jpg"> </div> <div id ="topnav"> <ul> <li><a id="onlink" href='index.html'>Process</a></li> <li><a href='status.html'>status</a></li> <li><a href='control.html'>Control</a></li> <li><a href='PID.html'>PID</a></li> <li><a href='spa.html'>Parameters</a></li> <li><a href='Manuals.html'>Manuals</a></li> <li><a href='network.html'>Network</a></li> </ul> </div> <div id ="data"> <form action="settings.html" method="get" id="unitsSetup" name="unitsSetup"> <table> <tr> <td>Design Units</td> <td><select name="designUnits"id="designUnits"> <option value="0">T/h(tons / hour)</option> <option value="1">t/h (tonnes / hour)</option> <option value="2">LT/h(long tons) / hour</option> <option value="3">kg/h (kilograms / hour)</option> <option value="4">lb/h(pounds / hour)</option> <option value="5">kg/min (kilograms / minute)</option> <option value="6"> lb/min (pounds / minute)</option> </td> </tr> <tr> <td>Design Speed Units</td> <td><select name="speedUnits" id="speedUnits"> <option value="0">Feet/min</option> <option value="1">Metres/s</option> </td> </tr> <tr> <td><input type="submit" name="save"></input></td> </tr> </table> <input type="hidden" name="settingsFile" id="settingsFile"value="<?--#exec cmd_argument='IncludeFile("settings.cfg")'-->"></input> <script language="javascript" type="text/javascript">readFileSettings()</script> </form> <?--#exec cmd_argument='SaveToFile("settings.cfg","#",Overwrite)'--> </div> <div id ="copywrite"> <p>Copywrite</p> </div> </div> </div> </body> </html> The Javascript function "readFileSettings() is shown below. function readFileSettings() { var readFile,designUnits,speedUnits; readFile =document.getElementById('settingsFile').value; designUnits = readFile.charAt(12); speedUnits = readFile.charAt(25); document.getElementById('speedUnits').selectedIndex = speedUnits; document.getElementById('designUnits').selectedIndex = designUnits; }
  9. http://jsbin.com/azipok/2/edit this piece of code does the trick of clearing up the option list of select menu and adding a "test" message, but this message becomes visible only upon dropping down the select menu. is there a way to make this "test" message display and replace the "no modules..." text upon clicking the button?
  10. For example, if you select the option with id="chocolate-yes" or id="vanilla-yes", the the option with id="icecreamcone-yes" will also be selected.As you can see on the image below, when you select the option with id="chocolate-yes", <select id="icecreamcone"> will be disabled. When both id="chocolate-yes" and id="vanilla-yes" are not selected the the option with id="icecreamcone-no" will not be disabled. To put it in simpler words: you always need to have an ice cream cone if you want to add vanilla or chocolate ice cream, with the exception of sprinkles Anyone know of a Javascript that can do this? Note 1: the option with id="sprinkles-yes" will not effect id="icecreamcone-yes".Note 2: id="icecreamcone-yes" need still be selectable prior to selecting id="vanilla-yes" or id="chocolate-yes".Note 3: id names cannot be changed, nor can you add more properties to the elements.Note 4: cannot use jQuery. <ul id="icecream" style="list-style:none;line-height:30px;"> <li> <select id="icecreamcone"> <option value="addicecreamcone">Would you like an ice cream cone?</option> <option id="icecreamcone-yes" value="yes">Yes</option> <option id="icecreamcone-no" value="no">No thanks</option> </select> </li> <li> <select id="vanilla"> <option value="addvanilla">Would you like to add vanilla ice cream?</option> <option id="vanilla-yes" value="yes">Yes</option> <option id="vanilla-no" value="no">No thanks</option> </select> </li> <li> <select id="chocolate"> <option value="addchocolate">Would you like to add chocolate ice cream?</option> <option id="chocolate-yes" value="yes">Yes</option> <option id="chocolate-no" value="no">No thanks</option> </select> </li> <li> <select id="sprinkles"> <option value="addsprinkles">Would you like to add sprinkles on top?</option> <option id="sprinkles-yes" value="yes">Yes</option> <option id="sprinkles-no" value="no">No thanks</option> </select> </li></ul>
  11. When you click a certain tag, an option will be selected. For example: you click on a Div tag with id="object3", this action will automatically select the Option tag "Water". Anyone know a Javascript that can do this (without using the value attribute)? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Click tag will select option</title></head> <body> <form action=""> <fieldset> <ul style="list-style:none;"> <li> <select id="select_items" name="SelectItems"> <option id="item-fire" value="xjakgd">Fire</option> <option id="item-earth" value="yuygas">Earth</option> <option id="item-water" value="piowqe">Water</option> <option id="item-wind" value="mnbvzi">Wind</option> </select> </li> </ul> </fieldset> </form> <div id="click-object-1" style="background-color:#F00;width:30px;height:30px;margin:4px;cursor:pointer;"></div><div id="click-object-2" style="background-color:#0F0;width:30px;height:30px;margin:4px;cursor:pointer;"></div><div id="click-object-3" style="background-color:#00F;width:30px;height:30px;margin:4px;cursor:pointer;"></div><div id="click-object-4" style="background-color:#FF0;width:30px;height:30px;margin:4px;cursor:pointer;"></div> </body></html>
  • Create New...