Quote:
Originally Posted by ghayenga
In your JavaScript function call:
window.location = "MYDUMMYURL?";
Then in your webView's delegate implement the shouldStartLoadWithRequest method and then do whatever you need to and return NO if it's calling MYDUMMYURL.
- (BOOL)webView  UIWebView*)p_webView shouldStartLoadWithRequest  NSURLRequest*)p_reques t
navigationType  UIWebViewNavigationType)p_navigati onType
|
Hi, sorry, got sidetracked by another project for a month and now I'm back to this one. Here is my JavaScript code:
Code:
function checkAnswers() {
// So far all answers are correct.
var allCorrect = true;
for ( var selectIndex = 0; selectIndex < document.theForm.elements.length; selectIndex++ ) {
curSelect = document.theForm.elements[selectIndex];
if ( curSelect.name == "quiz" ) {
for ( var optionIndex = 0; optionIndex < curSelect.options.length; optionIndex++ ) {
if ( curSelect.options[optionIndex].selected ) {
// Display checkmark for correct answers and an red X for wrong answers.
var answerResult = curSelect.options[optionIndex].value;
document.images[selectIndex].src = answerResult + "25.png";
if ( answerResult == "wrong" ) {
allCorrect = false;
}
}
}
}
}
}
This function basically determines which questions were answered correctly and then places a checkmark or X next to them. When a user finally gets all the questions correct, then I need to mark the lesson as being finished. Unfortunately I don't see a way of getting a variable's contents from the JavaScript back to my Objective-C application. Is this even possible?