swift写JS代码替换href

swift写JS代码替换href_第1张图片
Paste_Image.png
// 同时修改了按钮的颜色背景 修改全标签未实现
 func webViewDidFinishLoad(_ webView: UIWebView) {
        let jsString = "document.getElementsByClassName('db sideDate szIcon').item(0).style.backgroundColor = ('red')"
        let js_href = "document.getElementsByClassName('db sideDate szIcon')[0].href=\"http://120.76.78.245/__cache__/mobile/exit.html\";"
        //没实现
        let jsjsjs = "document.getElementsByClassName('db sideDate szIcon')[0].innerHTML=\"兑换市\""
        webView.stringByEvaluatingJavaScript(from: js_href)
//        webView.stringByEvaluatingJavaScript(from: jsString)
//        webView.stringByEvaluatingJavaScript(from: jsjsjs)
    }

你可能感兴趣的:(swift写JS代码替换href)