Jump to content

Using the same variable in more than one file


Adam Brave

Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...