UIWebView interacts with javascript. 1. uiwebview

Source: Internet
Author: User

UIWebView interacts with javascript. 1. uiwebview

I read two books last year and mentioned the interaction between UIWebView and javascript. However, I seldom submit specific operations. This year, I feel it is necessary to sort out this knowledge point.

First of all, you must reserve some simple javascript knowledge. I am reading this ebook javascript from entry to entry, and also have some basic html knowledge.
My main function is to load html files, operate the input boxes and buttons on html.
The code for test.html is as follows:

The code for test. js is as follows:

function check(){    var str = document.getElementById('input1').value    alert(str);}

The OC code will not be posted here. I believe that you can do almost all the work on IOS. You can determine how to load html files in UIwebview.
Here we will share with you the running effect:


We can see that this is only a response to the events on the page, but for example, the content of the input is not implemented yet. We will share it with you in the next article.
Demo

I have just started my study here. I hope I can have more exchanges with you. It would be better if I could be a master. ^ _*

Related Article

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.