I've been using display:none on the style property of some <option>
elements in my forms, which works fine with Mozilla - as expected it
removes the option from my dropdown (although it still exists in the
code). Is there an equivalent in IE?
The reasoning behind this is that I want users to rank objects using a
<select> for each place (see below), and to remove the choice of earlier
objects from <select> drop-downs later in the list.
I have a dropdown box which should display an appropriate text box only when a particualar option is selected. Currently, the textboxes are displayed all the time. I do have a Javascript function that works for 2 options(hides always and displays only when the correct option is selected). But I need it to work for 3 options. Here is the code. You can copy and paste this code as an HTML file and you will know what I refer to.
<head> <script type="text/JavaScript"> <!-- var whichOpt='select' function showOption(which) { //First hide the currently displaying menu. document.getElementById(whichOpt).style.display = "none";
//Determine what the new selection is. whichOpt = document.getElementById(which).options[document.getElementById(which).selectedIndex].value;
Code: <select class="g4" NAME="bonustype" id="bonustype" style="width:180" <option VALUE="select">Select an option</option> <option VALUE="signon">Sign-on bonus</option> <option VALUE="refer">Refer a friend bonus</option> </select> </div>
<table width=190px align=center><tr><td><div id="select" align=justify class=red>After selecting a bonus type, the criteria relating to that bonus will appear here.</div></td></tr></table>
<div id="signon" style="display:none;">SHOW SIGN ON CRITERIA</div>
<div id="refer" style="display:none;">SHOW SIGN ON CRITERIA</div>
However, at present I cannot get the 'signon' or 'refer' div's to appear. When the php page is loaded, 'After selecting a bonus type, the criteria relating to that bonus will appear here' will appear on the screen. When I select a different option for the 'bonustype' combo box, the writing will dissapear but nothing will show up instead. When selecting 'Select an option' again, the writing that appeared at the start does not show up.
therefore I take it that the javascript is not working correctly (i.e. not changing the style display option contained with in the div's). But why does the 'After selecting a bonus type, the criteria relating to that bonus will appear here' disappear when a different option is selected, but not appear again?
I want the drop down to "activate" the option values in the input field. So, when the user changed the options, they wil automatically appear int he input field.
I have a popup window. When a user click 'x' on the upper righthand corner to close the window, I want to display and message with yes or no option. Would you let me know how I can do this?
i trying to select a <select> option programatically. i can see in firebug that the value of the select tag change but not it's text. how could i select a option by displaying it's text?
i try $(mySelect).val(optionValue); and $(mySelect).find('option[value='1']").attr("selected","selected");
I am building a form with ColdFusion, HTML, and will be using some Javascript, and I wnt the javascript to tell one form object to display itself when a certain option is chosen from a <select> tag.
<cfquery name="getCategories" datasource="#mydatasource#" username="#myusername#" password="#mypassword#"> SELECT * FROM categories WHERE type = 'cat' ORDER BY id </cfquery> <cfform action="engine.cfm" method="post" format="html"> <table cellpadding="0" cellspacing="0"> <tr><th colspan="2">New Category</th> </tr><tr> <td>Category Type:</td> <td><select name="type"> <option value=" "></option> <option value="cat">Main Category</option> <option value="sub">Sub Category</option> </select></td></tr> <tr><td>Name:</td> <td><cfinput type="text" name="title" size="20" maxlength="100" required="yes" message="A name for the category is required."> </td></tr> <tr><td>Parent Category:</td><td> <cfselect enabled="Yes" name="parentcat" multiple="no" query="getCategories" value="id" display="title" queryPosition="below"> <option value=" "></option></cfselect> </td></tr><tr> <td colspan="2"><cfinput type="submit" name="submit" value="Submit" validate="submitonce" validateat="onserver,onsubmit"></td> </tr></table></cfform>
I want the <cfselect> tag to display on if Sub Category is selected on the first <select> tag. I expect that it will use the onchange attribute but other than that I have no idea.
I am trying to display a rel of each option as they are selected into a div below it . There are several selects of classProductAvailability on the page. When one of the selects changes, I'd like the value of the rel of the selected option to display.At first it seems to work, but only if you start by changing the last pull down menu. The trouble seems to be in the"select.ProductAvailability option:selected", this needs to be written for this instance, not all of the selects of that class on the page. How do I write that, I've tried$(this+" option:selected") but it won't take.
What I would like to do is have a page with a dropdown menu, and depending on which option the user chooses from the dropdown, reload the page and display a particular iframe below the dropdown, based on the users choice. Also, a default iframe would load (the one connected to the default choice in the select box). I was trying to make this work with PHP (without having the user having to click a submit button) but I couldn't find a way to make it happen.
I want to have several forms on one page that are not displayed until a selection is made from the category drop down box(select element). The form displayed will depend on the selection made. Here is the code I have so far.
I want to have several forms on one page that are not displayed until a selection is made from the category drop down box(select element). The form displayed will depend on the selection made.
I am searching a solution to change a ComboBox by popup I have found this script on the web. Is it also possible to select the newVendor just after adding? Is this script ok or are there better solutions?
<script type="text/javascript"> <!-- function message(value){ if(value=="newVendor"){// New Vendor is selected var vendor = prompt("Vandor's Name",""); var elementSelect = document.getElementById('vendor'); try{ [Code]....
Is there a way to achieve multithreading in JavaScript? I'm looking to fetch a page into a div while allowing the user to interact with another div. At some point the newly fetched page contents will be available to the div that the user is working in but I don't want to cause unnecessary blocking. I've thought of using frames (would prefer divs) plus timeouts and checking for when a load completes. Does anyone have an idea of how this could work?
A friend of mine has built as simple site for use on his company's intranet. It uses JavaScript to read comma-delimited information from a text file and displays it in tabular form.
When I looked at the source there is js like this:
function forwardClick() { if (sitelist.recordset.AbsolutePosition != sitelist.recordset.RecordCount) { sitelist.recordset.moveNext(); } else { alert("You are already at the last record in the database."); }}
wondering if there is a va_list equivalent in Javascript. Well, actually, I know that there is, but I don't know if its user... applicable. va_list in C/++ anyhow is a way of being able to pass in any number of arguments at the end of a function, I'll show an example:
So as you can see, the space is reserved at the end of the function declaration with the "..." syntax, and in the function body is expanded and processed. I could be way off here, but I think I'm on the right track.
I'm trying to find out if javascript has something akin to $$ in php.What I'm trying to do:
var costs = { cost1: 5, cost2: 10, cost3: 15 }
// Retrieve cost user has selected
alert(costs.selectedCost);
Its obviously a hyper-simplified example of what I'm trying to do, but the premise is the same. In PHP, I could use $$ to convert one variable into another, not sure if JS can do the same.
I have been trying to figure out how to access files on different servers through javascript, as i am converting an onsite myspace app to an iframe app, i need to get the contents of a file from the last.fm api and store it in a variable. Or maybe i could get it with php and store it in a javascript variable if that is possible,
Is there a javascript equivalent of PHP's nl2br() function? I have to send the value of a textarea to a new window that will display the text of what was in the box, which is why I need to somehow convert newlines to breaks.
I want to do some Win32 application automation from JavaScript. Is it possible? Failing that, is there a way to execute an application from JavaScript?
Does anyone know a way of passing parameters into a Javascript script 'from outside' via additions to the URL -- similar to (or even the same as!) the idea of CGI parameters?
The purpose of this line is to get the "href" value of a link when clicked on inside a content-editable iframe.I have the function working perfectly in IE, but not having much luck with Mozilla browsers.
Give me a sample program for converting Ascii value into its equivalent value.for example get the input as 65(Ascii value of A) and display 'A' as output