Multiple selection of Drop down listbox onChange

Sangwan Pankaj Reply 10:18

Multiple selection of a drop down listbox by using onChange event trigger. 
HTML CODE
<select id=p1 name=no_year onChange="show_month()"; multiple size=4><option value=Jan>January</option>
<option value=February>February</option>
<option value=March>March</option>
<option value=April>April</option>
<option value=June>June</option>
<option value=Jul>July</option>
<option value=Auguest>Auguest</option>
<option value=September>Septembr</option>
<option value=October>October</option>
<option value=November>November</option>
<option value=December>December</option>
</select>
<div id='getValue'><br><br></div>

JAVASCTIPT
<script type="text/javascript">
function show_month(){
var str='';
for (i=0;i<p1.length;i++) {
if(p1[i].selected){
str +=p1[i].value + "<br >";
}
}
document.getElementById("getValue").innerHTML=str;
return true;
}
</script>

Single selection of Drop down listbox onChange

Sangwan Pankaj Reply 10:14
Today's topic is :- The selected option of a drop down listbox by using onChange event trigger. The onChange event will trigger 1 JavaScript function and we will try to read the selected item by using getElementById

Option 1:-
HTML CODE
<select>
    <option value="1">pankaj</option>
    <option value="2">sangwan</option>
</select>
JAVASCTIPT
$('select').on('change', function() {
  alert( this.value ); // output of your selected value

})

Option 2:-
HTML CODE
<select id="mySelect" onchange="copy();">
<option value="">Select a person:</option>
    <option value="pankaj" >pankaj</option>
    <option value="gurinder" >gurinder</option>
    <option value="avneet" >avneet</option>
    <option value="John Smith" >John Smith</option>
</select>
//value shows in here
<div id="label"></div>

JAVASCTIPT
function copy() { document.getElementById("label").innerHTML=document.getElementById("mySelect").value

}


Option 3:-
HTML CODE

<label for="continent">Select Continent</label>
  <select id="continent" onchange="countryChange(this);">
    <option value="empty">Select a Continent</option>
    <option value="North America">North America</option>
    <option value="South America">South America</option>
    <option value="Asia">Asia</option>
    <option value="Europe">Europe</option>
  </select>
  <br/>
  <label for="country">Select a country</label>
  <select id="country">
    <option value="0">Select a country</option>

  </select>

JAVASCTIPT
<script type="text/javascript">
 //<![CDATA[
 // array of possible countries in the same order as they appear in the country selection list
 var countryLists = new Array(4)
 countryLists["empty"] = ["Select a Country"];
 countryLists["Asia"] = ["India", "China", "Japan", "Nepal"];
 countryLists["North America"] = ["Canada", "United States", "Mexico"];
 countryLists["South America"] = ["Argentina", "Chile", "Brazil"];
 countryLists["Europe"]= ["Spain", "France", "Germany", "Britain"];

 function countryChange(selectObj) {
 // get the index of the selected option
 var idx = selectObj.selectedIndex;
 // get the value of the selected option
 var which = selectObj.options[idx].value;
 // use the selected option value to retrieve the list of items from the countryLists array
 cList = countryLists[which];
 // get the country select element via its known id
 var cSelect = document.getElementById("country");
 // remove the current options from the country select
 var len=cSelect.options.length;
 while (cSelect.options.length > 0) {
 cSelect.remove(0);
 }
 var newOption;
 // create new options
 for (var i=0; i<cList.length; i++) {
 newOption = document.createElement("option");
 newOption.value = cList[i];  // assumes option string and value are the same
 newOption.text=cList[i];
 // add the new option
 try {
 cSelect.add(newOption);  // this will fail in DOM browsers but is needed for IE
 }
 catch (e) {
 cSelect.appendChild(newOption);
 }
 }
 }
//]]>

</script>



Test Credit Card Account Numbers for Test Payments

Sangwan Pankaj Reply 12:58

Test Credit Card Account Numbers

While testing, use only the credit card numbers listed here. Other numbers produce an error.
Expiration Date must be a valid date in the future (use the mmyy format). for ex:- may 2018 and use cvv - 123

Test Credit Card Account Numbers

Credit Card Type
Credit Card Number
American Express
378282246310005
American Express
371449635398431
American Express Corporate
378734493671000
Australian BankCard
5610591081018250
Diners Club
30569309025904
Diners Club
38520000023237
Discover
6011111111111117
Discover
6011000990139424
JCB
3530111333300000
JCB
3566002020360505
MasterCard
5555555555554444
MasterCard
5105105105105100
Visa
4111111111111111
Visa
4012888888881881
Visa
4222222222222
Note : Even though this number has a different character count than the other test numbers, it is the correct and functional number.
Processor-specific Cards
Dankort (PBS)
76009244561
Dankort (PBS)
5019717010103742
Switch/Solo (Paymentech)
6331101999990016
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us