Adam Brave Posted January 11, 2013 Share Posted January 11, 2013 Hi, I have one html file where I use the following expression: <select name=selMonth onChange='changeCal()'>"; Then, I have another file, this one is a php file, where I want to use the selected value on the dropdown list select object. I tried to use the following expression in the php file but it didn't worked: var xpto = parseInt(document.calForm.selMonth.value); It presents me nothing... Can someone help me please? Regards, Link to comment Share on other sites More sharing options...
justsomeguy Posted January 11, 2013 Share Posted January 11, 2013 Select elements don't have a value property, they have an array of options and a selectedIndex property. You use the selectedIndex to figure out which option they have selected, and then get the value from that option. var xpto = parseInt(document.calForm.selMonth.options[document.calForm.selMonth.selectedIndex].value); Link to comment Share on other sites More sharing options...
thescientist Posted January 11, 2013 Share Posted January 11, 2013 what exactly is the relationship between these two files? I'm not sure I get how you are expecting them to interact. Link to comment Share on other sites More sharing options...
Adam Brave Posted January 11, 2013 Author Share Posted January 11, 2013 Select elements don't have a value property, they have an array of options and a selectedIndex property. You use the selectedIndex to figure out which option they have selected, and then get the value from that option. var xpto = parseInt(document.calForm.selMonth.options[document.calForm.selMonth.selectedIndex].value); It didn't worked =\ Link to comment Share on other sites More sharing options...
Adam Brave Posted January 11, 2013 Author Share Posted January 11, 2013 what exactly is the relationship between these two files? I'm not sure I get how you are expecting them to interact. Well, the first file is a calendar. The second file appear when I click on a day of the calendar...now I want the month and the year of the day I clicked =) Link to comment Share on other sites More sharing options...
justsomeguy Posted January 11, 2013 Share Posted January 11, 2013 Check your browser for Javascript errors. This isn't PHP code by the way, you're showing Javascript code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now