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