JQuery funktioniert nicht auf WebView

Ich habe versucht, um JQuery-Dateien in assets/scripts und auf Internet, aber die Warnmeldung nicht angezeigt. Ich habe die log-Ausgabe und machen es output.html es funktioniert in Windows (so seltsam!).
Was ist das problem mit WebView?

public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    webView = (WebView) findViewById(R.id.webView);
    final String s = "<html><head>" +
    "<link href=\"css/my.css\" type=\"text/css\" rel=\"stylesheet\" />" +
    "<script src=\"scripts/jquery-1.6.2.min.js\" rel=\"stylesheet\" type=\"text/javascript\"></script>" +
    "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js\" type=\"text/javascript\"></script>" +
    "<script>" +
    "$(document).ready(function(){ alert('hello'); });" +
    "</script>" +
    "</head><body><div>All I hear is raindrops." +
    "Falling on the rooftop. Oh baby tell me why you have to go. " +
    "Cause this pain I feel you won't go away. And today, " +
    "I'm officially missing you.</div></body></html>";
    webView.getSettings().setJavaScriptEnabled(true);
    Log.d("Something", s);
    webView.loadDataWithBaseURL("file:///android_asset/", s, "text/html", "utf-8", null);
}

Dies ist die log-Ausgabe nach dem hinzufügen der Erweiterung ".html -". Es funktioniert auf Firefox, aber nicht auf WebView. 🙁

<html>
<head>
<link href="css/my.css" type="text/css" rel="stylesheet" />
<script src="scripts/jquery-1.6.2.min.js" rel="stylesheet" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js" type="text/javascript"></script>
<script>$(document).ready(function(){ alert('hello'); });</script>
</head>
<body>
    <div>
    All I hear is raindrops.Falling on the rooftop. Oh baby tell me why you have to go. Cause this pain I feel you won't go away. And today, I'm officially missing you.
    </div>
</body>
</html>

InformationsquelleAutor der Frage Emerald Hieu | 2011-07-19

Schreibe einen Kommentar