无法从另一个函数执行脚本函数myFunction

时间:2018-05-12 06:59:27

标签: javascript html function

function editBaancode() {
  var baan1 = "<div class='dropdown'>";
  var baan2 = "<button onclick=myFunction() class='dropbtn'>Dropdown</button>";
  var baan4 = "<div id='myDropdown' class='dropdown-content'>";
  var baan5 = "<div id='myDropdown' class='dropdown-content'><input type='text' placeholder='Search..' id='myInput' onkeyup=filterFunction()";
  var baan7 = "><a>About</a>";
  var baan8 = "<a>Base</a>";
  var baan9 = "<a>Blog</a>";
  var baan10 = "<a href=#>CREATE</a>";
  var baan11 = "</div>";
  var baan12 = "</div>";
  var res = baan1.concat(baan1, baan2, baan4, baan5, baan7, baan8, baan9, baan10, baan11, baan12);
  document.getElementById('mylocation').innerHTML = res;
}

1 个答案:

答案 0 :(得分:0)

请参阅此处的工作链接 - &gt;你是否按照与此相同的方式做事? jsbin

Try This: To insert data into Info Table      

  btnInsert.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = edname.getText().toString();
                String phn = edphone.getText().toString();
                String addr = edaddress.getText().toString();
                insertData(name,addr,phn);

            }
        }); 


    public void insertData(String name, String address, String phoneNumber) {
                SQLiteDatabase database = dbHelper.getWritableDatabase();

                    ContentValues contentValues = new ContentValues();
                    contentValues.put("Name", name);
                    contentValues.put("phone", address);
                    contentValues.put("address", phoneNumber);
                    database.insert("Info", null, contentValues);

            }