Webviewer String for numerical value?

I've followed this excellent example: "App Inventor Code Snippets | Pura Vida Apps" to get strings from webviewer to AI2 and it works with no problems. I've never used webviewer, HTML or JavaScript before but I'm having problems trying to get a numerical value which in webviewer is stored in a variable named score, This is the JavaScript that I have made to transfer the value of 'score' to AI2:

 scoree = score;
 window.AppInventor.setWebViewString(scoree)  

But this script gives me a "nan" error.
Any help?

Thank you

You might want to show us more from the html and Javascript

Taifun

Got it! My problem was in the JavaScript, I fixed it like this:

window.AppInventor.setWebViewString(SCORE_VALUE + " Pages= " + nPages + " Type= " + subject);

I was trying to convert everything to a string thinking that webview would not accept numbers but it does send whatever the variable value is.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.