iphone开发webview 修改所有相应tag背景

 [webViewstringByEvaluatingJavaScriptFromString:

     @"var script = document.createElement('script');"

     "script.type = 'text/javascript';"

     "script.text = \"function ResetTextBgColor() { "

     "var links = document.getElementsByTagName('p');"

     "for (var i=0;i<links.length;i++) {"

     "links[i].style.backgroundColor= 'red';"

     "};"

     "}\";"

     "document.getElementsByTagName('head')[0].appendChild(script);"];

    [webViewstringByEvaluatingJavaScriptFromString:@"ResetTextBgColor();"];

你可能感兴趣的:(iPhone,webView,p,BAC)