Use WebView's Stringbyevaluatingjavascriptfromstring method to interact and provide an instance directly.
Download: http://download.csdn.net/detail/heyuan110/4420050
Attach document, location, Body property method JS Object
Document: Attribute Document.title//set a document title equivalent to HTML <title> tagsDocument.bgcolor//set the page background colorDocument.fgcolor//Set foreground colors (text color)Document.linkcolor//non-clicked link colorDocument.alinkcolor//color of the activation link (focus on this link)Document.vlinkcolor//the color of the link that has been clickedDocument. Url//set the URL property to open another page in the same windowDocument.filecreateddate//file build date, read-only propertyDocument.filemodifieddate//file modification Date, read-only propertyDocument.filesize//file size, read-only propertyDocument.cookie//set up and read out cookiesDocument.charset//set character sets Simplified Chinese: gb2312Document: Method document.write ()//dynamically writing content to a pageDocument_createelement_x_x (TAG)//Create an HTML tag objectDocument.getelementbyidx_x_x (ID)//object that obtains the specified ID valueDocument.getelementsbyname (Name)//gets the object that specifies the name valuedocument.body.a (Otag) Body: Sub-object Document.body//specifies that the beginning and end of a document body is equivalent to <body></body>Document.body.bgColor//Sets or gets the background color behind the objectDocument.body.link//non-clicked link colorDocument.body.alink//color of the activation link (focus on this link)Document.body.vlink//the color of the link that has been clickedDocument.body.text//text colorDocument.body.innerText//set the text between <body>...</body>Document.body.innerHTML//set the HTML code between <body>...</body>Document.body.topMargin//page Top marginDocument.body.leftMargin//Page left marginDocument.body.rightMargin//page Right marginDocument.body.bottomMargin//Page Bottom MarginDocument.body.background//Background ImageDOCUMENT.BODY.A (Otag)//dynamically generate an HTML objectLocation : Sub-object Document.location.hash//#号后的部分Document.location.host//domain + port numberDocument.location.hostname//Domain nameDocument.location.href//full URLDocument.location.pathname//Catalog SectionDocument.location.port//Port numberDocument.location.protocol//Network Protocol (http:)Document.location.search//the part after the numberCommon Object events: Documeny.location.reload ()//Refresh Web pageDocument.location.reload (URL)//Open a new pageDocument.location.assign (URL)//Open a new pageDocument.location.replace (URL)//Open a new pageselection-Selection Sub-object Document.selection
iOS and JS interact to get webview elements and assignments