简体   繁体   中英

Javascript: Get radio-button value from another html page

Hi everybody

Background: I currently build an online unit-converter which be can be seen under http://okconvert.com/index.php?option=com_content&view=article&id=126&Itemid=1262 . In the bottom left corner you find an orange button named "Conversion Settings". After a click on this button, the user shall be able to select how exact his unit conversions shall be. He/She chooses an accuracy (for example 3 or 4 digits), then clicks "Apply settings".

When the user actually does a conversion afterwards, he clicks on the button "Ok, convert." and a javascript is called which calculates results

Question Which would be the smartest way to access the value of the selected radio button from the pop-up in the javascript? I googled a lot and found some answers but none of them really seems to suite my needs. Here are two possibilities I'm considering:

  • Using HTML5 local storage (I need to have a default conversion-accuracy, so this might not be useful because applying conversion settings shall only be optional)
  • Using jQuery/Ajax to load the custom html and use some kind of GetElementbyID for the loaded page

Additional information After clicking on the orange button, a "JCE Mediabox" is opened which is filled with some custom html. The pop-up actually links to the custom html page, so I could access that url if needed. I have some basic knowledge about javascript, html and css but have never used jqueries/ajax before.

Any help or hints would be highly appreciated

With best regards, Felix http://www.okconvert.com

How about dropping the value in a cookie. It's simple enough, keeps the state on the client and works over all windows and popups you care to open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM