入力フィールドに入力された式をファイルで検索し、その結果を前後に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*/