我的javascript方法是从objective c调用的,我试图将从objective接收到的值放在html的文本框中。起初它来了,但随后页面被刷新,文本框失去了价值
function square(val)
{
alert('Entered value is ="+val);
document.getElementById('txtshow').value=val;
}
piece of code written in objective c from where i am calling javascript is-
(i am calling this javascript on button's click)
-(IBAction)btnResultClicked:(id)sender
{
NSString *function=[NSSTring stringWithhFormat:@"square(%d)",val];
[webView loadHTMLSt5ring:strFile baseURL:nil];
[webView stringByEvaluatingJavaScriptFromString:function];
webView.backgroundColor=[UIColor clearColor];
[self.view addSubView:webView];
}