| | |
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 automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select software sql text textarea unicode w3c window windowofwords windowsxp \n





