Interaction between iOS oc and html (js method called in oc), iosoc
I. Running 1. effect at the beginning 2. effect after running 2. Work 1. Import an HTML file to the original content of the 2、jiaohu.html file in the ocproject
32.16.html file operations from oclanguage --- add, delete, modify, and query 1). query operation
var p = document.getElementById('word');
2). Delete
NSString*html =@"var p = document.getElementById('word');";NSString*html2 =@"p.remove();";[webViewstringByEvaluatingJavaScriptFromString:html];[webViewstringByEvaluatingJavaScriptFromString:html2];
3). Change Operation
NSString * htmlUpdate = @ "var change = document. getElementsByClassName ('change') [0]; "" change. innerHTML = 'changed value'; "; [webViewstringByEvaluatingJavaScriptFromString: htmlUpdate];
4). insert
// Insert operation 1
// Insert 2NSString * htmlInsert = @ "var img = document. createElement ('img '); "" img. src = 'img11.jpg '; "" img. width = '000000'; "" img. height = '20140901'; "" document. body. appendChild (img); "; [webViewstringByEvaluatingJavaScriptFromString: htmlInsert];