It is that UIWebview and toggle button on UIView.
WebPage includes javascript.
I want to control UIWebView's javascript.
What I want is that whenever Button on UIView is toggled, javascript is turned on or off.
Is it possible?
If so, how can i do? It is sad that I don't have idea.
This is my javascript code:
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *var = nil;
var = @"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>"
"<html> "
" <head> "
" <title> New Document </title> "
"<script type='text/javascript'> "
"function colorChange(){ "
" var id=document.getElementById('yellow'); "
" var backcolor = id.style.backgroundColor; "
" "
" if (backcolor != '') "
" { "
" id.style.backgroundColor = ''; "
" }else{ "
" id.style.backgroundColor = '#ffff00'; "
" } "
" "
"} "
"</script> "
" </head> "
" <body> "
"<script type='text/javascript'> "
"</script> "
" "
"<span id='yellow' ><a href=\"javascript:void(0)\" onclick='colorChange();'><font size=12>text</font></a></span></head></html>";
[self.webView loadHTMLString:var baseURL:nil];
}