PDA

View Full Version : Cut & Paste JSE internal seach engine v 1.0a



Onsight
08-08-2016, 11:51 PM
http://www.javascriptkit.com/script/script2/jse/

Above is link to free search engine in javascript. I m not a javascript expert and I really need help with this. Everything is working fine to me, only links on result.html page are on click opened in same window. I need them to open in specific frame, target. How I must change script to get this?
Can someone help me, please?

jscheuer1
08-09-2016, 12:39 AM
At the end of the jse_search.js file, we see:


function out_jse() {
if (co == 0) {
document.write('Your search did not match any documents.<p>Make sure all keywords are spelt correctly.<br>Try different or more general keywords.');
return;
}
for (var a = 0; a < r.length; a++) {
var os = r[a].split("^");
if (bold == 1 && m == 1) {
var br = "<b>" + d + "</b>";
os[2] = os[2].replace(pat, br);
}
if (include_num == 1) {
document.write(a + 1, '. <a href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
} else {
document.write('<a href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
}
}

}

Using a text only editor, insert your preferred target to both link constructions (highlighted in the above), save and use the new version (example assuming a new window/tab using target="_blank"):


function out_jse() {
if (co == 0) {
document.write('Your search did not match any documents.<p>Make sure all keywords are spelt correctly.<br>Try different or more general keywords.');
return;
}
for (var a = 0; a < r.length; a++) {
var os = r[a].split("^");
if (bold == 1 && m == 1) {
var br = "<b>" + d + "</b>";
os[2] = os[2].replace(pat, br);
}
if (include_num == 1) {
document.write(a + 1, '. <a target="_blank" href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
} else {
document.write('<a target="_blank" href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
}
}

}

Problems or questions? Let me know. The page will probably need to be refreshed to see changes. The browser cache might need to be cleared. If there are still issues, a link to your page where you are having them will help us help you.

Onsight
08-09-2016, 12:52 AM
Thank you very much. Works!! You are awesome.
Thanks again :)