0
function linkClick(e) {
  alert(e.target.href);
}

function setDefaultLinkHandlers(){
  links = document.getElementsByTagName('a');
  for (i = 0; i < links.length; i++)
  links[i].addEventListener('click', linkClick, false);
}

document.onload=setDefaultLinkHandlers();

这是 JavaScript

String Url = "http://dev.taxmann.com/actruleservice/ActRuleService.asmx/GetFileHTML?FileID_or_FullPath=102120000000025184";
String htmlResp = getStringPage(Url);

WebSettings webSettings = webview.getSettings();

String k = Html.fromHtml((String) htmlResp).toString().replace(");'", "");

k是获取 HTML 的字符串,我必须在此 HTML 中添加该 JavaScript。谁能告诉我如何添加这个?

4

1 回答 1

0
String myJavascript = "<script>"+"your javascript here"+"</script></head>";

htmlResp = htmlResp.replace("</head>", myJavascript);

String k = ....
于 2013-04-24T05:20:22.790 回答