0

入力フィールドに入力された式をファイルで検索し、その結果を前後にn文字の div で返し、式を太字で返す必要があります。そのコマンドの結果が位置であることを知っているので、javascriptのsearch()関数を使用して結果を返す方法がわかりません。これまでのところ、私はこれしか持っていません:

var length = expr.legth;/*get the length of the expression searched*/
var indexString = docSearched.search(expression);/*get the position of the expression in the document*/

そして今、私はそのようなものが必要になります:

var el = document.getElementById('content'); 
    el.innerHTML = docSearched[indexString];/*display the all the occurence of the searched expression*/
4

1 に答える 1

0

これが私がやった方法です:

string.substring(beginning,end);
于 2013-06-04T07:28:28.910 に答える