Lightwalker
asked on
Get Javascript results into a hidden field or php variable
Dear Experts,
I have found a very nice javascript script that detects users timezone. The javascript calculates the timezone and then checks the results again a select menu, to display the correct timezone.
It is not perfect but for my purposes it works well. What I need it to put the javascript into a hidden form field or create a variable from the results from the timezone.js so I can then insert into my DB.
I do not know javascript at all and I do not even know were to begin. I have included the two files. index.html that has the select menu and the timezone.js which does the calculation.
index.html detect-timezone.js
Many thanks as always
I have found a very nice javascript script that detects users timezone. The javascript calculates the timezone and then checks the results again a select menu, to display the correct timezone.
It is not perfect but for my purposes it works well. What I need it to put the javascript into a hidden form field or create a variable from the results from the timezone.js so I can then insert into my DB.
I do not know javascript at all and I do not even know were to begin. I have included the two files. index.html that has the select menu and the timezone.js which does the calculation.
index.html detect-timezone.js
Many thanks as always
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
function timezonefunction() {
result= .... do something ...;
document.getElementById('M
}
</script>
</head>
<body onLoad=timezonefunction()>
<form name="some_name" action="new_url">
<div id=MyHiddenField></div>
.....
You can place a div box with an id and modify that div box using javascript as shown in above example.