前端外刊评论 2018-01-18



var p = document.getElementById('word');NSString*html =@"var p = document.getElementById('word');";
NSString*html2 =@"p.remove();";
[webViewstringByEvaluatingJavaScriptFromString:html];
[webViewstringByEvaluatingJavaScriptFromString:html2];NSString*htmlUpdate =@"var change = document.getElementsByClassName('change')[0];"
"change.innerHTML = '更改后的值';";
[webViewstringByEvaluatingJavaScriptFromString:htmlUpdate];//插入操作1

//插入操作2
NSString*htmlInsert =@"var img = document.createElement('img');"
"img.src = 'img11.jpg';"
"img.width = '200';"
"img.height = '200';"
"document.body.appendChild(img);";
[webViewstringByEvaluatingJavaScriptFromString:htmlInsert];