iOS and JS interact to get webview elements and assignments

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.