Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

HTML <Select multiple > and Javascript

Javascript coding ..

Moderators: macek, egami, gesf

HTML <Select multiple > and Javascript

Postby popeye » Wed Sep 19, 2012 8:47 am

I am having problem retrieving and storing selected options array from a multiple <Select>. Please see below:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="javascript" type="text/javascript">
function SelectAll(SelectedOptions) {
 msg='';
 for (var i=0;i<SelectedOptions.selected.length;i++) {
 msg +=SelectedOptions.options[i].selected;
 {
 alert(msg);
}
</script>
</head>
<body>
<form name="selform" id="selform" method="post">
<select name="fruits[]" multiple size="10">
<option value="Apple">Red Apple</option>
<option value="Pearl">Bosc Pearl</option>
<option value="Grape">Globe Grape</option>
<option value="Orange">California Orange</option>
<option value="Peach">Georgia Peach</option>
</select>
<input type="button" name="submit1" value="Submit" onclick="SelectAll(fruits);">
</form>
</body>
</html>

I can not get anything displyed by the javascript. Thx
User avatar
popeye
New php-forum User
New php-forum User
 
Posts: 120
Joined: Sat Jan 03, 2004 7:06 pm
Location: New York, NY

Re: HTML <Select multiple > and Javascript

Postby TomCornar » Mon Sep 24, 2012 12:06 am

Hi ,

Try the below Code.

Code: Select all
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled</title>
    <script language="javascript" type="text/javascript">
    function SelectAll() {
       
     var SelectedOptions = document.getElementById("fruits");
       
     var msg="";
     for (var i=0;i<SelectedOptions.options.length;i++) {
         if (SelectedOptions.options[i].selected) {

    var selvalue=SelectedOptions.options[i];
     msg +=selvalue.value;
         }
     }
     alert(msg);
    }
    </script>
    </head>
    <body>
    <form name="selform" id="selform" method="post">
    <select name="fruits"  id="fruits" multiple size="10">
    <option value="Apple">Red Apple</option>
    <option value="Pearl">Bosc Pearl</option>
    <option value="Grape">Globe Grape</option>
    <option value="Orange">California Orange</option>
    <option value="Peach">Georgia Peach</option>
    </select>
    <input type="button" name="submit1" value="Submit" onclick="SelectAll();">
    </form>
    </body>
    </html>


Hope this Helps.

Regards,
Tom Cornar
Trinay Technology Solutions
http://www.trinay.com
User avatar
TomCornar
New php-forum User
New php-forum User
 
Posts: 25
Joined: Fri Sep 14, 2012 12:06 am

Please check for me why this form is not validating

Postby ebenezerdodoo » Fri Apr 26, 2013 3:20 am

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"/>

<title>Registration form example</title>
</head>
<body>
<script type="text/javascript">
/* <![CDATA[ */

var errpresent = false;

function validateForm(){

runnerid_validate()
runnerid_validate()
eventid_validate()
date_validate()
fintime_validate()
position_validate()
category_validate()
agegrade_validate()

if (errpresent == true){
alert("Please correct the highlighted errors");
return false;

}
}

// Add error message to invalid data entry

function addMessage(id, text)

{

var textNode = document.createTextNode(text);

var element = document.getElementById(id);

element.appendChild(textNode);

}

// Runner ID Validate

function runnerid_validate()

{

var RunnerID = document.getElementById('RunnerID').value;

var test_expression = /[0-9]+/



if (RunnerID.length >0){

if (test_expression.test(RunnerID)) {

return true;

}

else {

addMessage("runiderr","Must be a number in the range 1-99999");

document.getElementById('runiderr').style.background="yellow";

errpresent =true;

return false;

}

}

else {

addMessage("runiderr","Please enter your Runner ID");

document.getElementById('runiderr').style.background="yellow";
errpresent =true;

return false;

}



}

// Event ID Validate

function eventid_validate()

{

var EventID = document.getElementById('EventID').value;

var test_expression = /[0-9]+/

if (EventID.length >0){

if (test_expression.test(EventID)) {

return true;

}

else {

addMessage("evtiderr","Must be a number in the range 1-99999");

document.getElementById('evtiderr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("evtiderr","Please enter the Event ID");

document.getElementById('evtiderr').style.background="yellow";
errpresent =true;

return false;

}

}
// DATE Validate

function date_validate()

{

var Date = document.getElementById('Date').value;

var test_expression = /^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/

if (Date.length >0){

if (test_expression.test(Date)) {

return true;

}

else {

addMessage("dateerr","Date must be in yyyy-mm-dd format");

document.getElementById('dateerr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("dateerr","Please enter a date in yyyy-mm-dd format");

document.getElementById('dateerr').style.background="yellow";
errpresent =true;

return false;

}

}

// Finish Time Validate

function fintime_validate()

{

var FinishTime = document.getElementById('FinishTime').value;

var test_expression = /^(?:(?:(\d+):)?(\d+):)?(\d+)/



if (FinishTime.length >0){

if (test_expression.test(FinishTime)) {

return true;

}

else {

addMessage("fintimerr","must be in hh:mm:ss format");

document.getElementById('fintimerr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("fintimerr","Please enter a Finish Time in hh:mm:ss format");

document.getElementById('fintimerr').style.background="yellow";
errpresent =true;

return false;

}



}
// Position Validate

function position_validate()

{

var Position = document.getElementById('Position').value;

var test_expression = /[0-9]+/

if (Position.length >0){

if (test_expression.test(Position)) {

return true;

}

else {

addMessage("poserr","Must be a number in the range 1-99999");

document.getElementById('poserr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("poserr","Please enter your Position");

document.getElementById('poserr').style.background="yellow";
errpresent =true;

return false;

}



}

// Category Validate

function category_validate()

{

var CategoryID = document.getElementById('CategoryID').value;

var test_expression = /[0-9]+/



if (CategoryID.length >0){

if (test_expression.test(CategoryID)) {

return true;

}

else {

addMessage("caterr","Must be a number in the range 1-99");

document.getElementById('caterr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("caterr","Please enter your Category ID");

document.getElementById('caterr').style.background="yellow";
errpresent =true;

return false;

}



}

// Age Grade Validate

function agegrade_validate()

{

var AgeGrade = document.getElementById('AgeGrade').value;

var test_expression = /^\s*-?\d+(\.\d{1,2})?\s*/



if (AgeGrade.length >0){

if (test_expression.test(AgeGrade)) {

return true;

}

else {

addMessage("ageerr","Must be a number with two decimal places");

document.getElementById('ageerr').style.background="yellow";
errpresent =true;

return false;

}

}

else {

addMessage("ageerr","Please insert Age Grade");

document.getElementById('ageerr').style.background="yellow";
errpresent =true;

return false;

}

}

/* ]]> */
</script>
</head>

<body>

<h1>Submit Runner Time</h1>

<form name="demo" method="post" ONSUBMIT= return "validateForm()" action="http://mct.tt284.open.ac.uk/b2files/storedata.php">

<table>
<!-- runner id should not be empty and should be a number not a string -->

<tr><td>
Runner Id:

</td><td>

<input type="text" name="RunnerID" id="RunnerID" size="5" maxlength="5"/></td>

<td><p id="runiderr"></p></td></tr>

<!-- event id should not be empty and should be a number not a string -->

<tr><td>
Event Id:

</td><td>

<input type="text" name="EventID" id="EventID" size="5" maxlength="5"/>

</td>

<td><p id="evtiderr"></p></td>

</tr>

<!-- date should not be empty and should be in yyyy-mm-dd format -->

<tr><td>

Date:

</td><td>

<input type="text" name="Date" id="Date" size="10" maxlength="10"/>

</td>

<td><p id="dateerr"></p></td>

</tr>

<!-- finish time should not be empty and should be in hh:mm:ss format -->
<tr><td>

Finish Time:

</td><td>

<input type="text" name="FinishTime" id="FinishTime" size="10" maxlength="10"/>

</td>

<td><p id="fintimerr"></p></td>

</tr>

<!-- position should be a number -->

<tr><td>

Position:

</td><td>

<input type="text" name="Position" id="Position" size="5" maxlength="5"/>

</td>
<td><p id="poserr"></p></td>

</tr>

<!-- category should be a number in the reang 1-100 -->
<tr><td>

Category:

</td><td>

<input type="text" name="CategoryID" id="CategoryID" size="3" maxlength="3"/>

</td>

<td><p id="caterr"></p></td>

</tr>

<!-- agegrade should be a number -->

<tr><td>

Age Grade:

</td><td>

<input type="text" name="AgeGrade" id="AgeGrade" size="5" maxlength="5"/>

</td>

<td><p id="ageerr"></p></td>

</tr>

<!-- personal best can be yes or no -->

<tr><td>

Personal Best:

</td><td>

<input name="PB" type="radio" value="0" checked="checked"> No

<input name="PB" value="1" type="radio"> Yes

</td>

<td><p id="pberr"></p></td>

</tr>

</table>

<input type="submit" value="Submit form" >

<p id ="errorMessage">

</p>

</form>

</body>

</html>
ebenezerdodoo
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Apr 19, 2013 2:59 am
Location: GERMANY

herve leger shop cheapest Herve Leger on sale (1)

Postby galloway8 » Thu May 16, 2013 2:48 am

Want to be seen as an expert in your field? Starting a blog will help you do just that. Use your blog to build a reputation and reach customers at the same time.
As you begin to blog, start simple since you do not want to announce that all of this is new to you. By simply beginning your blog and adding to it daily, you are creating the foundation for a great, online marketing tool. As you are writing for [url=/]herve leger for sale[/url] your blog, remember to keep your content interesting, professional and on point.
If you become frustrated building your blog, keep it to yourself. You do not want to get in the habit of ranting on your blog, nor do you want [url=/]herve leger skirts[/url] to be talking sales on your blog. Instead, you want to talk about important developments in your field or niche. Write for a large audience even if you don't have one.
Then to get an idea of how a good blog should look, go visit other websites and see how they behave, what they discuss and how [url=/]herve leger bandage dress sale[/url] they discuss it. Then take a look at your site, and see where you need to make improvements. Look at things like your graphics, layout, presentation, content and the actual writing. Is your site interesting, or is it just taking up space? Good content is the key to gaining a blog readership.
Get Creative with your Business Blogging Tips
You can find ready-made templates and hire a writer to give to give your blog a professional polish. So [url=/]herve leger bags[/url] take the time to develop your own look and feel. If you find a blog that you like, do not simply clone it. Look at what other blogs offer, and take the best parts of the design to use on your own blog. Always be on the lookout for things that you can use to improve your blog, and then you will create a blog that is better than any of the ones that you used for inspiration.
If you simply cannot come up with your own idea, then you can start with someone else's idea and customize the heck out of it. Try to find a customizable theme so you can give your blog its own identity. Change the colors, the proportions and even the font to get it to be as unique as possible. You want your blog to look professional and individual, so you can save time starting with a free theme template, but then make it unique.
Whenever you start a blog, no one will be looking. You can start letting people know about your blog, and in time you will build a readership. It is probably not a good idea to post stats on your site until you actually have at least a few hundred followers. Keep adding content. There more content you have, the bigger your readership will be. There will come a day when you have created a huge body of work, and you will probably also notice that you have developed quite a readership as well.
Changing your stats on your own will hurt your reputation. Let them develop [url=/]herve leger fall[/url] naturally. If you want to build up your numbers and comments more quickly, simply join a couple of forums on your topic, and invite readers to review your blog and leave comments. Offer to do the same for them. This way you may even get some good feedback on ways that you can improve your blog as well. As you begin to get comments, make sure to respond to them where applicable, because you will frequently start a conversation that will keep that reader coming back to check in on you.
Another great way to increase the comments left for your blog is for you to leave various comments on other people's blogs. Using links will get people to visit your blog. More often than not the owner of the blog will be curious enough to check out your blog, for many of the same reasons that you are visiting their blog. This is a process rather than a one-click solution, however it is very effective. As you are leaving comments, just know that once they are posted they are permanent, so always be professional with your comments
Once your audience is established, you can cut back on your comments, but you should still continue to interact with your blogging community, because it is a synergistic system.
A few simple rules can help you with blogging.
- NEVER alter stats. It is dishonest.
- Showcase your achievements.
- Always be positive and professional with your posts and comments.
- Always respond to reader feedback and thank them for it. Then invite further comment by asking a question.
- Building a blog is a slow process so keep going even when it seems like nothing is happening.
- Keep making regular posts. Even if you do [url=/]herve leger white[/url] not get comments, eventually you will build an impressive body of work, and visitors will find you.
Blogging is a great way to connect with your customers and readers. It starts out pretty slowly, but if you follow these business blogging tips, in time you will have a full community of followers who look forward to your regular posts.

Related articles:


herve lege

herve legers cheapest Herve Leger on sale (43)

cheap herve leger cheapest Herve Leger on sale (13
galloway8
New php-forum User
New php-forum User
 
Posts: 127
Joined: Mon Jan 07, 2013 3:36 am

vintage herve leger cheapest Herve Leger on sale (

Postby galloway8 » Thu May 16, 2013 2:56 am

REASON #1: Using GM crops, farmers can reduce pesticide spraying, decrease greenhouse gas emissions and increase yields.
Evidence continues to accumulate about how genetically modified food crops are helping to preserve the environment. "Here we have a very versatile technology, which has the power and the capacity to contribute to a more effective, a more benign, a more sustainable agriculture," says Dr. Clive James, an agricultural scientist and founder of the not-for-profit International Service for the Acquisition of Agri-biotech Applications (ISAAA).
For example, insect-resistant (Bt) crops offer an alternative to, and reduce the use of, agricultural pesticides such as insecticides and fungicides. Since Bt corn and cotton are able to produce their own protection against specifically targeted pests, farmers can reduce the amount of pesticides necessary to control them. Since 1996, farmers have reduced pesticide applications by 172,000 metric tons as a direct result of genetically modified food crops.
"What's been amazing to many of us is that we've seen advances that even were beyond our wildest expectations," says Dr. Roger Beachy regarding genetically engineered plants. Dr. Beachy is a researcher and founding president of the not-for-profit Donald Danforth Plant Science Center. "We all knew it was theoretically possible, but to actually do it and deploy it into the field. And then, at the end of four or five years, report that this has an advantage of increasing yields and reduce the use of agriculture chemicals by 50 million pounds a year. It's an astounding number."
This reduction in the use of pesticides has consequently reduced the fuel, water and packaging that are used to manufacture, distribute and apply pesticides. Typical savings include the elimination of diesel fuel that is used in manufacturing, shipping and storing insecticides; the conservation of water used by farmers when applying pesticides; the elimination of tractor and aviation fuel also used in applications; and a reduction in the waste generated from the disposal of packaging.
Herbicide-tolerant crops have enabled farmers to use more benign herbicides that rapidly dissipate in soil and water. In addition, herbicide-tolerant crops have spurred the adoption of no till farming ? the reduction or elimination of plowing to remove weeds and disturb the soil for planting. The environmentally beneficial tillage practices conserve topsoil, preserving soil moisture and reducing runoff; reduce the release of greenhouse gas emissions; and create and improve habitats for birds and other wildlife.
Genetically modified food crops also assist in producing more food on the same amount of land, which reduces the need to clear additional land for cultivation. This results in less impact on prairies, wetlands, forests and other fragile ecosystems that might otherwise be converted for agricultural purposes.
"Production in Brazil has increased significantly without great increases in the area required for agriculture. There is great pressure at present concerning certain environments, such as the Brazilian mountainous regions and the wetlands, the Amazon region," says Dr. Francisco Arag?o, senior researcher in Genetic Research and Biotechnology at Embrapa in Brazil. "One of the ways we help preserve these areas is by increasing productivity without having to increase the amount of land used for agriculture."
Scientists agree that habitat destruction is the biggest single threat to biodiversity. Producing increasing amounts of food without increasing arable land has a major impact on protecting wildlife habitats.
"Biodiversity is essential for all life on earth. And all kinds of agriculture ? including organic farming ? is a threat to biodiversity," says Dr. Klaus Ammann on the importance of biodiversity. Dr. Ammann is an honorary professor emeritus and former director of the Botanical Garden at the University of Bern in Switzerland. "There are many ways of doing better in agriculture, but one of the most efficient and best ways is biotechnology."
"I've studied this carefully, and the evidence is fairly clear on certain points," says The Honorable Lord Taverne on the safety of genetically modified foods. Lord Taverne is a member of the House of Lords in the United Kingdom Parliament and founder of the charity Sense about Science. "It's reduced the use of pesticides. It produces greater productivity. And, if it reduces the amount of farmland you have to use, it can actually be very beneficial to biodiversity."
REASON #2: Increased yield and income from biotech crops improves the quality of life for farmers in developing countries.
Small- and large-scale family farms worldwide are benefiting from increased yields, reduced production costs, or both in some instances to create significantly improved net economic returns as a result of genetically modified food crops.
"If you look at the adoption of biotech crops since 1996, it's been on a significant upward curve in terms of the area planted. And the primary driver of that has been the economic benefits that farmers have derived from it ? US$28 billion worth of extra farm income to the farmers who have used the technology," says Graham Brookes about the advantages of biotechnology in agriculture. Brookes is an agricultural economist and director of PG Economics in England. "Now that increase in farm income has been spread across all the countries that have used the technology, both in the developed world and in developing countries."
Of the 10.3 million farmers who planted biotech crops in 22 countries in 2006, 90 percent were small, resource-poor farmers from 11 developing countries including Argentina, Brazil, China, Columbia, Honduras, India, Mexico, Paraguay, Philippines, South Africa and Uruguay. In these areas, the increased income from biotech crops makes a contribution to the economics of family farms and the alleviation of poverty.
"Poverty today is a rural phenomenon. 80 percent of the poor people that we have on this planet today are farmers or people that work on farms," explains Dr. James. "So, therefore, if you can introduce biotech crops that will increase the income of these people, then you are making a direct contribution to the alleviation of poverty."
"If we give important technologies to grow more food in poor places ? better seed varieties, better ways to manage soil nutrients, better ways to manage plant pathogens ? it's going to create livelihoods. It's going to create income in the villages. It's going to convert what is now sub-subsistence agriculture into commercial farming. ? helping the poorest of the poor to invest in a sustainable future for themselves," says Dr. Jeffrey Sachs about the pros of genetically modified foods in alleviating hunger in developing countries. Dr. Sachs is the [url=/]herve leger strapless dresses[/url] director of the Earth Institute and of the United Nations Millennium Project.
As agricultural productivity increases in the developing world, it also drives economic growth and expands imitation herve leger dress opportunities to trade, resulting in more and better jobs, better health care and better education. "We interviewed 10,000 farmers spread across India," says Dr. Laveesh Bhandari, economist and director of Indicus Analytics in India. "What our study shows is that the impact on overall development of the household and herve leger high neck the community is quite phenomenal in Bt cotton-producing areas. Greater incomes, greater access to healthcare services, greater education, and on many different dimensions ? we find that Bt cotton production makes the farmer, the household and the community better off."
Global population projections suggest that by 2020, there will be an additional 1.2 billion people on the planet, which is equivalent to the population of Africa and South America combined. "Looking ahead to the year 2050, we will have to herve leger black strapless dress produce the food and fiber for something approaching 10 billion people," says Dr. Norman Borlaug, the 1970 Nobel Peace Prize Recipient [url=/]herve leger price range[/url] for his leadership role in the Green Revolution to increase food production. "Can we do it? I say yes. If we continue to develop technology ? including more widespread application of biotechnology."
&copy; 2007 Monsanto Company. All rights reserved. The copyright holder consents to the use of this material and the images in the published context only and herve leger look a like dresses solely for the purpose of promoting the benefits of agricultural biotechnology.

Related articles:


cheap herve leger cheapest Herve Leger on sale (13

herve leger cheapest Herve Leger on sale \(19\)

white herve leger dress cheapest Herve Leger on sa
galloway8
New php-forum User
New php-forum User
 
Posts: 127
Joined: Mon Jan 07, 2013 3:36 am


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron