| | |
javascript for date using if condition
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 0
i have one statement .that statement has two combo field(Entered/Approved) .
when combo field is marked as Approved then date isto be moved to date field.and date should not moved to date field when entered is selected from combo feild
i mean i want to move todays date if and only if Approved is selected from combo field
when combo field is marked as Approved then date isto be moved to date field.and date should not moved to date field when entered is selected from combo feild
i mean i want to move todays date if and only if Approved is selected from combo field
Since i don't have any reference in your code. I will just play a simple demo based on what you wanted to happend. Here's the basic to deal with it...
javascript Syntax (Toggle Plain Text)
<html> <head> <title><!--Sample--></title> <script type="text/javascript"> <!-- document.onclick = function(e) { e = e ? e : window.event; t = e.target ? e.target : e.srcElement; var approved = frm1.rdo[1]; var now = new Date(); var month = (now.getMonth()+1); var date = now.getDate(); var year = now.getFullYear(); month = ( month < 10 ? '0' : '' ) + month; date = ( date < 10 ? '0' : '' ) + date; var today = month + '-' + date + '-' + year; if ( t.name && t.name == 'rdo' && approved.checked ) { frm1.txt.value = today; } else { alert('Do your things from here!') } } //--> </script> </head> <body> <form name="frm1" action="javascript:void(0);" onSubmit="return false;"> <label><input type="radio" name="rdo" value="Entered" /> Entered</label> <label><input type="radio" name="rdo" value="Approved" /> Approved</label><br /><br /> <label> Date Field: </label> <input type="text" name="txt" value="" style="text-align:center;color:red;font-weight:700;width:100px;" /> </form> </body> </html>
![]() |
Similar Threads
- value doesnt get carried to next page (PHP)
- display time (PHP)
- dynamic dropdown selection (PHP)
- problem in javascript coding in asp page (ASP)
- vBulletin mod_rewrite for vB 3.0.7 (Existing Scripts)
- insert database (ColdFusion)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript basic:
- Next Thread: Problem related to JSP and Javascript
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box bug calendar cart checkbox class codes column createrange() css cursor date debugger decimal design dom download dropdown element embed enter error explorer firefox focus form frameworks getselection google gwt hiddenvalue hint html htmlform ie7 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 object onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select shopping size software sql text textarea toggle unicode w3c website window windowofwords windowsxp wysiwyg





