Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
HTML Pages with CSS and JavaScript
to fetch multiple ids
Govinda Gopala
Greenhorn
Posts: 18
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Following is the scenario i want to pass multiple idds into javascript and fetch those values into the
java
how am i suppose to do this
the code is as follows
javascript
<script type="text/javascript"> function isDate(txtDate) { var objDate, // date object initialized from the txtDate string mSeconds, // txtDate in milliseconds day, // day month, // month year; // year // date length should be 10 characters (no more no less) if (txtDate.length !== 10) { return false; } // third and sixth character should be '/' if (txtDate.substring(2, 3) !== '/' && txtDate.substring(5, 6) !== '/') { return false; } // extract month, day and year from the txtDate (expected format is mm/dd/yyyy) // subtraction will cast variables to integer implicitly (needed // for !== comparing) month = txtDate.substring(3, 5) - 1; // because months in JS start from 0 day = txtDate.substring(0, 2) - 0; year = txtDate.substring(6, 10) - 0; // test year range if (year < 1000 || year > 3000) { return false; } // convert txtDate to milliseconds mSeconds = (new Date(year, month, day)).getTime(); // initialize Date() object from calculated milliseconds objDate = new Date(); objDate.setTime(mSeconds); // compare input date and parts from Date() object // if difference exists then date isn't valid if (objDate.getFullYear() !== year || objDate.getMonth() !== month || objDate.getDate() !== day) { return false; } // otherwise return true return true; } function checkDate(dummy1,dummy2){ // define date string to test var txtDate2 = document.getElementById(dummy1).value; // check date and print message if (isDate(txtDate2)) { document.getElementById("NoteForUser").innerHTML = ""; } else { document.getElementById("NoteForUser").innerHTML = "Please Enter Valid Date"; } } </script>
following is the html
<html> <head> </head> <body> <h1>enter the Date</h1> <span id='NoteForUser'></span> <input type="textfield" id="txtDate"> <button type="button" onclick="checkDate(txtDate,NoteForUser)">Validate Date</button> </body> </html>
Komal Renu
Ranch Hand
Posts: 51
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Send it through url parameters or use form properties.
Using Form properties is a better solution.
Thanks and Regards,
-------------------------------------------------------------------------------------
Komal Renu |
krenu@infocepts.com
| www.infocepts.com
-------------------------------------------------------------------------------------
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
to pass the id into javascript
help with validation/ 2 functions on submit.
javascript validation
resultset is not working properly
How to set timer for select the time am to pm on front end in a jsp page like calender for date?
More...