Solved

D is null or not an object

Posted on 2004-08-25
18
354 Views
Last Modified: 2007-12-19
I am currently running a javascript search engine on my website. Its actully a free one. Does anyone know where either I could get another free search engine where all the pages are run off of my website. Not free find. Or can someone help me u with this error message. In the status bar it give me an error D is null or not  an object. Does anyone know what his is from and how to fix it. I am currently using jse10a. its a free internal search engine locted at http://javascriptkit.com/script/script2/jse/index.shtml I refer if you have an easy to use simple to set up search engine but if you could fix this problem id appreciate that. The search engine could be in php,javascipt,perl,any cgi script. Thanks so much.
0
Comment
Question by:sgreeny12
  • 10
  • 8
18 Comments
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
Could you post a link to your site online anywhere (or even a test page that shows the behavior you're describing)? It'll be easier to troubleshoot that way, rather than digging through the original source.
0
 

Author Comment

by:sgreeny12
Comment Utility
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
From what I can tell, "d" has the query that you are searching for.  That value is supposed to be stored in a cookie, but that value won't/can't be set the first time someone loads your page, or if they haven't used the search yet.  Try changing these lines in jse_search.js:

if (d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') {
      m = 1;
}
var r = new Array();
var co = 0;

if (m == 0) {

to:
if (d && d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') {
      m = 1;
}
var r = new Array();
var co = 0;

if (d && m == 0) {

The idea is to stop execution of the script if there is nothing set for d in the cookie.  Hope that helps.

P.S.  You also seem to include the jse_form.js file twice - once in the <head> section and once in the <body>.  I assume that wasn't intentional?
0
 

Author Comment

by:sgreeny12
Comment Utility
Actually it was intentional but i only did it for like 2 hours. I thought it may have been a possible fix but that didnt help. I thought it wasnt working cause I am using include but that wasn't the case. Anyway I have a question about your last post. Should I just copy and paste the stuff you wrote or should I edit it myself because I dont really know javascript so I wouldnt really be able to do that. Thanks for the help.
0
 

Author Comment

by:sgreeny12
Comment Utility
I copied that stuff in I dont know if it helped. Now it says object expected. THe page is located at http://cncg.com/sgreenstein/index.php Maybe I copied it wrong Im not 100% sure. If you could please check it out. Thanks you
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
You can copy and paste what I wrote.  Just change jse_search.js using my previous post, and it should get rid of the "d" is null or not an object error.  Let me know if that helps.
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
You currently have this:
if (d && m == 0) {

if (m == 0) {
      var woin = new Array();
      var w = d.split(" ");


Instead, it should be this:
if (d && m == 0) {
      var woin = new Array();
      var w = d.split(" ");

Basically, just delete the "if (m == 0) {" line.  By leaving it there, you mismatched your parentheses.  Again, let me know if that helps.
0
 

Author Comment

by:sgreeny12
Comment Utility
Now it says object expected line 119 char 1 the url is http://cncg.com/sgreenstein/index.php
Thanks so much for the help
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
It looks like you copied *everything* from my post, including the line saying "(change your script) to:", which isn't valid js code.  =P  To avoid any further confusion just erase everything in jse_search.js, and replace it with the following (don't worry, you won't lose anything, I've included the stuff that was already there).  Does it work now?

// ---------- script properties ----------
var include_num = 1;
var bold = 0;

// ---------- sites ----------
var s = new Array();

s[0] = "Home^index.php^This our home page^ main, index, home, first page, phone of the month";
s[1] = "JSE DOCUMENTATION^doc.txt^JSE is a client-side local site search engine. Written entirely in JavaScript 1.3 it works with browsers from Netscape 4.7 to Microsoft Internet Explorer 6.0 ...^ faq, docs, instructions";
s[2] = "JSE DOCUMENTATION^doc.txt^JSE is a client-side local site search engine. Written entirely in JavaScript 1.3 it works with browsers from Netscape 4.7 to Microsoft Internet Explorer 6.0 ...^ faq, docs, instructions";
s[3] = "Queens College^queens_main.php^Go to the Queens College notes tests page^ qc, queens college, queens college notes, queens college tests, tests, notes,queens collge notes and tests, qc notes, qc tests, qc notes and tests";
s[4] = "HAFTR^haftr_main.php^Go to the HAFTR notes tests page ^ haftr, haftr notes, haftr tests, tests, notes,haftr notes and tests";
// ---------- Advertising ----------
s[5] = "Metroland^advertising/july 2004/cncg metroland.pdf^Metroland advertisment^ pdf, metroland, metroland, full page, week commencing, Albany, ";
s[6] = "Baltimore City Paper^advertising/july 2004/cncg baltimore city paper.pdf^Baltimore City Paper advertisment^ pdf, Baltimore City, baltimore city, full page, week commencing, baltimore,Baltimore, ";
s[7] = "Artvoice^advertising/july 2004/cncg Artvoice.pdf^Artvoice advertisment^ pdf, artvoice, Artvoice, full page, week commencing, Buffalo,buffalo, ";
s[8] = "Chicago Sun Times^advertising/july 2004/cncg Chicago Sun Times.pdf^Chicago Sun Times advertisment^ pdf, Chicago Sun Times, Chicago sun times, full page, week commencing, Chicago,chicago, ";
s[9] = "Dollar Wise ^advertising/july 2004/cncg DollarWise.pdf^Baltimore City Paper advertisment^ pdf, Baltimore City, baltimore city, full page, week commencing, Albany, ";
s[10] = "Alive^advertising/july 2004/CNCG ALIVE.pdf^Alive Advertisment^ pdf, columbus, Columbus, full page, week commencing,";
s[11] = "Free Times^advertising/jjuly 2004/.php^Free Times Advertisment^ pdf, Cleveland, cleveland, full page, week commencing,";
s[12] = "Thrifty Nickel Fresno^advertising/july 2004/CNCG Thrifty Nickel Fresno.pdf^Thrifty Nickel Advertisment Fresno^ pdf, Fresno, fresno, full page, week commencing, thrifty nickel, Thrifty Nickel;"
s[13] = "Thrifty Nickel Visalia^advertising/july 2004/CNCG Thrifty Nickel Visalia.pdf^Thrifty Nickel Advertisment Visalia^ pdf, Visalia, visalia, full page, week commencing, thrifty nickel, Thrifty Nickel;"
s[14] = "Houston Press Left^advertising/july 2004/jjuly 2004/CNCG Houston Press L.pdf^Houston Press Left^ pdf, Houston, houston,left, Left, full page, week commencing, houston press, Houston Press;"
s[15] = "Houson Press Right^advertising/july 2004/CNCG Houston Press R.pdf^Houston Press Right^ pdf, houston press, Houston Press, full page, week commencing, Houston, houston;"
s[16] = "Daily News^advertising/july 2004/CNCG DN July04.pdf^Daily News July advertisment^ pdf, New York, new york, full page, week commencing, Daily News, daily news;"
s[17] = "Markeeter^advertising/july 2004/CNCG Markeeter.pdf^Markeeter advertisment^ pdf, New York, new york, full page, week commencing, Markeeter, markeeter;"
s[18] = "Miami/Ft Lauderdale/Palm Beach^advertising/july 2004/CNCG LA Weekly.pdf^Street Miami/City advertisment^ pdf, Miami, miami, ft lauderdale, Ft Lauderdale, Palm Beach, full page, week commencing, street miami city, Street Miami City;"
s[19] = "louisville Eccentric Observer^advertising/july 2004/CNCG louisville eccentric observer.pdf^Louisville Eccentric Observer advertisment^ pdf, Loisville, louisville, full page, week commencing;"
s[20] = "Las Vegas Weekly/Mercury^advertising/july 2004/CNCG LA Weekly.pdf^Las Vegas Weekly advertisment^ pdf, las vegas, Las Vegas, full page, week commencing;"
s[21] = "Orange Couny Weekly^advertising/july 2004/CNCG LA Weekly.pdf^Orange County Weekly advertisment^ pdf, orange county, Orange County, full page, week commencing, Los Angeles, los angeles, Long Beach, long beach;"
s[22] = "North East Times^advertising/july 2004/CNCG north East Times.pdf^North East Times Advertisment^ pdf, North East Times, north east times, full page, week commencing, Philadelphia, philadelphia;"
s[23] = "News And Review^advertising/july 2004/CNCG News & Review.pdf^News And Review Sacramento Advertisment^ pdf, news and review, News and Review, full page, week commencing, Sacramento, sacramento;"
s[24] = "News And Review^advertising/july 2004/CNCG Sacramento News & Reviews.pdf^News And Review Reno Advertisment^ pdf, news and review, News and Review, full page, week commencing, Sacramento, sacramento;"
s[25] = "City Newspaper^advertising/july 2004/CNCG City Newspaper.pdf^City Newspaper Advertisment^ pdf, City Newspaper, city newspaper, full page, week commencing, Rochester, rochester;"
s[26] = "San Diego Reader^advertising/july 2004/CNCG San Diego Reader L.pdf^San Diego Reader Advertisment^ pdf, San Diego, san diego, left, Left, full page, week commencing;"
s[27] = "San Diego Reader^advertising/july 2004/CNCG San Diego Reader R.pdf^San Diego Reader Advertisment^ pdf, San Diego, san diego, right, Right, full page, week commencing;"
s[28] = "San Francisco Bay Gaurdian^advertising/july 2004/CNCG San Fransisco Bay Guardian.pdf^San Fransisco Bay Guardian Advertisment^ pdf, San Fransisco, san fransisco, Bay Guardian, bay guardian,San Fransisco Bay Guardian, san fransisco bay guardian, full page, week commencing, oakland, Oakland;"
s[29] = "New Times^advertising/july 2004/CNCG San Louis Obispo.pdf^San Louis Obispo Advertisment^ pdf, San Louis, san louis, obispo, obispo,San Louis obispo, san louis obispo, full page, week commencing, New Times, new times;"
s[30] = "Indepedent^advertising/july 2004/CNCG LA Weekly.pdf^Independent Advertisment^ pdf, Santa Barbara, santa barbara, independant, Independent, full page, week commencing;"
s[31] = "New Times Syracuse^advertising/july 2004/CNCG syracuse new times.pdf^Syracuse New Times Advertisment^ pdf, New Times, new times, Syracuse, syracuse, full page, week commencing;"
s[32] = "Ventura County Reporter^advertising/jjuly 2004/CNCG LA Weekly.pdf^ Ventura County Reporter Advertisment^ pdf, Ventura County Reporter, ventura county reporter, Reporter, reporter, full page, week commencing;"
s[33] = "Portfolio^advertising/jjuly 2004/CNCG portfolio.pdf^ Portfolio Advertisment^ pdf, Virginia Beach, virginia beach, norfolk, Norfolk, Portfolio, portfolio, full page, week commencing;"
s[34] = "Washington Times^advertising/jjuly 2004/CNCG washington times.pdf^ Washington Times Advertisment^ pdf, Washington DC, washington dc, DC, dc, Washington Times, washington times, full page, week commencing;"
// ---------- end of script properties and sites ----------

var cookies = document.cookie;
var p = cookies.indexOf("d=");
if (d && d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') {
     m = 1;
}
var r = new Array();
var co = 0;

if (d && m == 0) {
      var woin = new Array();
      var w = d.split(" ");
      for (var a = 0; a < w.length; a++) {
            woin[a] = 0;
            if (w[a].charAt(0) == '-') {
                  woin[a] = 1;
            }
      }
      for (var a = 0; a < w.length; a++) {
            w[a] = w[a].replace(/^\-|^\+/gi, "");
      }
      a = 0;
      for (var c = 0; c < s.length; c++) {
            pa = 0;
            nh = 0;
            for (var i = 0; i < woin.length; i++) {
                  if (woin[i] == 0) {
                        nh++;
                        var pat = new RegExp(w[i], "i");
                        var rn = s[c].search(pat);
                        if (rn >= 0) {
                              pa++;
                        } else {
                              pa = 0;
                        }
                  }
                  if (woin[i] == 1) {
                        var pat = new RegExp(w[i], "i");
                        var rn = s[c].search(pat);
                        if (rn >= 0) {
                              pa = 0;
                        }
                  }
            }
            if (pa == nh) {
                  r[a] = s[c];
                  a++;
            }
      }
      co = a;
}

if (m == 1) {
      d = d.replace(/"/gi, "");
      var a = 0;
      var pat = new RegExp(d, "i");
      for (var c = 0; c < s.length; c++) {
            var rn = s[c].search(pat);
            if (rn >= 0) {
                  r[a] = s[c];
                  a++;
            }
      }
      co = a;

}


function return_query() {
      document.jse_Form.d.value = od;
}

function num_jse() {
      document.write(co);
}

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>');
            }
      }

}
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:sgreeny12
Comment Utility
I copied all of the above but unfortunatly I still receive an error. Line 115 char 6 od is undefined. Do you know how to fix that? It can be found at http://cncg.com/sgreenstein/index.php
Thanks so much
0
 

Author Comment

by:sgreeny12
Comment Utility
I dont know if this helps but there is one page that doesnt have any errors.
http://cncg.com/sgreenstein/cincinnati_coverage.php
Maybe that tells you what the problem is. Also the errors are different on every page. Maybe its the same fproblem but on 1 page it says r is undefined. Thanks.
0
 

Author Comment

by:sgreeny12
Comment Utility
Im sorry it says r.legth is null or not an object on the search results page. Maybe its the same problem I dont know. Thanks so much
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
Okay, slight tweak.  Try this (by the way, sorry for all the confusion and multiple posts for changing a few lines of code):

// ---------- script properties ----------
var include_num = 1;
var bold = 0;

// ---------- sites ----------
var s = new Array();

s[0] = "Home^index.php^This our home page^ main, index, home, first page, phone of the month";
s[1] = "JSE DOCUMENTATION^doc.txt^JSE is a client-side local site search engine. Written entirely in JavaScript 1.3 it works with browsers from Netscape 4.7 to Microsoft Internet Explorer 6.0 ...^ faq, docs, instructions";
s[2] = "JSE DOCUMENTATION^doc.txt^JSE is a client-side local site search engine. Written entirely in JavaScript 1.3 it works with browsers from Netscape 4.7 to Microsoft Internet Explorer 6.0 ...^ faq, docs, instructions";
s[3] = "Queens College^queens_main.php^Go to the Queens College notes tests page^ qc, queens college, queens college notes, queens college tests, tests, notes,queens collge notes and tests, qc notes, qc tests, qc notes and tests";
s[4] = "HAFTR^haftr_main.php^Go to the HAFTR notes tests page ^ haftr, haftr notes, haftr tests, tests, notes,haftr notes and tests";
// ---------- Advertising ----------
s[5] = "Metroland^advertising/july 2004/cncg metroland.pdf^Metroland advertisment^ pdf, metroland, metroland, full page, week commencing, Albany, ";
s[6] = "Baltimore City Paper^advertising/july 2004/cncg baltimore city paper.pdf^Baltimore City Paper advertisment^ pdf, Baltimore City, baltimore city, full page, week commencing, baltimore,Baltimore, ";
s[7] = "Artvoice^advertising/july 2004/cncg Artvoice.pdf^Artvoice advertisment^ pdf, artvoice, Artvoice, full page, week commencing, Buffalo,buffalo, ";
s[8] = "Chicago Sun Times^advertising/july 2004/cncg Chicago Sun Times.pdf^Chicago Sun Times advertisment^ pdf, Chicago Sun Times, Chicago sun times, full page, week commencing, Chicago,chicago, ";
s[9] = "Dollar Wise ^advertising/july 2004/cncg DollarWise.pdf^Baltimore City Paper advertisment^ pdf, Baltimore City, baltimore city, full page, week commencing, Albany, ";
s[10] = "Alive^advertising/july 2004/CNCG ALIVE.pdf^Alive Advertisment^ pdf, columbus, Columbus, full page, week commencing,";
s[11] = "Free Times^advertising/jjuly 2004/.php^Free Times Advertisment^ pdf, Cleveland, cleveland, full page, week commencing,";
s[12] = "Thrifty Nickel Fresno^advertising/july 2004/CNCG Thrifty Nickel Fresno.pdf^Thrifty Nickel Advertisment Fresno^ pdf, Fresno, fresno, full page, week commencing, thrifty nickel, Thrifty Nickel;"
s[13] = "Thrifty Nickel Visalia^advertising/july 2004/CNCG Thrifty Nickel Visalia.pdf^Thrifty Nickel Advertisment Visalia^ pdf, Visalia, visalia, full page, week commencing, thrifty nickel, Thrifty Nickel;"
s[14] = "Houston Press Left^advertising/july 2004/jjuly 2004/CNCG Houston Press L.pdf^Houston Press Left^ pdf, Houston, houston,left, Left, full page, week commencing, houston press, Houston Press;"
s[15] = "Houson Press Right^advertising/july 2004/CNCG Houston Press R.pdf^Houston Press Right^ pdf, houston press, Houston Press, full page, week commencing, Houston, houston;"
s[16] = "Daily News^advertising/july 2004/CNCG DN July04.pdf^Daily News July advertisment^ pdf, New York, new york, full page, week commencing, Daily News, daily news;"
s[17] = "Markeeter^advertising/july 2004/CNCG Markeeter.pdf^Markeeter advertisment^ pdf, New York, new york, full page, week commencing, Markeeter, markeeter;"
s[18] = "Miami/Ft Lauderdale/Palm Beach^advertising/july 2004/CNCG LA Weekly.pdf^Street Miami/City advertisment^ pdf, Miami, miami, ft lauderdale, Ft Lauderdale, Palm Beach, full page, week commencing, street miami city, Street Miami City;"
s[19] = "louisville Eccentric Observer^advertising/july 2004/CNCG louisville eccentric observer.pdf^Louisville Eccentric Observer advertisment^ pdf, Loisville, louisville, full page, week commencing;"
s[20] = "Las Vegas Weekly/Mercury^advertising/july 2004/CNCG LA Weekly.pdf^Las Vegas Weekly advertisment^ pdf, las vegas, Las Vegas, full page, week commencing;"
s[21] = "Orange Couny Weekly^advertising/july 2004/CNCG LA Weekly.pdf^Orange County Weekly advertisment^ pdf, orange county, Orange County, full page, week commencing, Los Angeles, los angeles, Long Beach, long beach;"
s[22] = "North East Times^advertising/july 2004/CNCG north East Times.pdf^North East Times Advertisment^ pdf, North East Times, north east times, full page, week commencing, Philadelphia, philadelphia;"
s[23] = "News And Review^advertising/july 2004/CNCG News & Review.pdf^News And Review Sacramento Advertisment^ pdf, news and review, News and Review, full page, week commencing, Sacramento, sacramento;"
s[24] = "News And Review^advertising/july 2004/CNCG Sacramento News & Reviews.pdf^News And Review Reno Advertisment^ pdf, news and review, News and Review, full page, week commencing, Sacramento, sacramento;"
s[25] = "City Newspaper^advertising/july 2004/CNCG City Newspaper.pdf^City Newspaper Advertisment^ pdf, City Newspaper, city newspaper, full page, week commencing, Rochester, rochester;"
s[26] = "San Diego Reader^advertising/july 2004/CNCG San Diego Reader L.pdf^San Diego Reader Advertisment^ pdf, San Diego, san diego, left, Left, full page, week commencing;"
s[27] = "San Diego Reader^advertising/july 2004/CNCG San Diego Reader R.pdf^San Diego Reader Advertisment^ pdf, San Diego, san diego, right, Right, full page, week commencing;"
s[28] = "San Francisco Bay Gaurdian^advertising/july 2004/CNCG San Fransisco Bay Guardian.pdf^San Fransisco Bay Guardian Advertisment^ pdf, San Fransisco, san fransisco, Bay Guardian, bay guardian,San Fransisco Bay Guardian, san fransisco bay guardian, full page, week commencing, oakland, Oakland;"
s[29] = "New Times^advertising/july 2004/CNCG San Louis Obispo.pdf^San Louis Obispo Advertisment^ pdf, San Louis, san louis, obispo, obispo,San Louis obispo, san louis obispo, full page, week commencing, New Times, new times;"
s[30] = "Indepedent^advertising/july 2004/CNCG LA Weekly.pdf^Independent Advertisment^ pdf, Santa Barbara, santa barbara, independant, Independent, full page, week commencing;"
s[31] = "New Times Syracuse^advertising/july 2004/CNCG syracuse new times.pdf^Syracuse New Times Advertisment^ pdf, New Times, new times, Syracuse, syracuse, full page, week commencing;"
s[32] = "Ventura County Reporter^advertising/jjuly 2004/CNCG LA Weekly.pdf^ Ventura County Reporter Advertisment^ pdf, Ventura County Reporter, ventura county reporter, Reporter, reporter, full page, week commencing;"
s[33] = "Portfolio^advertising/jjuly 2004/CNCG portfolio.pdf^ Portfolio Advertisment^ pdf, Virginia Beach, virginia beach, norfolk, Norfolk, Portfolio, portfolio, full page, week commencing;"
s[34] = "Washington Times^advertising/jjuly 2004/CNCG washington times.pdf^ Washington Times Advertisment^ pdf, Washington DC, washington dc, DC, dc, Washington Times, washington times, full page, week commencing;"
// ---------- end of script properties and sites ----------

var cookies = document.cookie;
var p = cookies.indexOf("d=");
var d;

if (p != -1) {
      var st = p + 2;
      var en = cookies.indexOf(";", st);
      if (en == -1) {
            en = cookies.length;
      }
      var d = cookies.substring(st, en);
      d = unescape(d);
}
var od = d;
var m = 0;

if (d && d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') {
     m = 1;
}
var r = new Array();
var co = 0;

if (d && m == 0) {
     var woin = new Array();
     var w = d.split(" ");
     for (var a = 0; a < w.length; a++) {
          woin[a] = 0;
          if (w[a].charAt(0) == '-') {
               woin[a] = 1;
          }
     }
     for (var a = 0; a < w.length; a++) {
          w[a] = w[a].replace(/^\-|^\+/gi, "");
     }
     a = 0;
     for (var c = 0; c < s.length; c++) {
          pa = 0;
          nh = 0;
          for (var i = 0; i < woin.length; i++) {
               if (woin[i] == 0) {
                    nh++;
                    var pat = new RegExp(w[i], "i");
                    var rn = s[c].search(pat);
                    if (rn >= 0) {
                         pa++;
                    } else {
                         pa = 0;
                    }
               }
               if (woin[i] == 1) {
                    var pat = new RegExp(w[i], "i");
                    var rn = s[c].search(pat);
                    if (rn >= 0) {
                         pa = 0;
                    }
               }
          }
          if (pa == nh) {
               r[a] = s[c];
               a++;
          }
     }
     co = a;
}

if (m == 1) {
     d = d.replace(/"/gi, "");
     var a = 0;
     var pat = new RegExp(d, "i");
     for (var c = 0; c < s.length; c++) {
          var rn = s[c].search(pat);
          if (rn >= 0) {
               r[a] = s[c];
               a++;
          }
     }
     co = a;

}


function return_query() {
     document.jse_Form.d.value = od;
}

function num_jse() {
     document.write(co);
}

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>');
          }
     }
}
0
 

Author Comment

by:sgreeny12
Comment Utility
1 more thing. It works and I dont see any errors anywhere but do you know why its says undefined in the search input box. It should say search cncg. Thanks
http://cncg.com/sgreenstein/index.php
0
 
LVL 19

Expert Comment

by:dakyd
Comment Utility
That's because it sets the search input box to whatever the variable od is.  The first time you load up your page, od is "undefined".  Find this part in jse_search.js:

function return_query() {
     document.jse_Form.d.value = od;
}


CHange it to this:
function return_query() {
     if (od)
       document.jse_Form.d.value = od;
     else
       document.jse_Form.d.value = "Search CNCG";
}
0
 

Author Comment

by:sgreeny12
Comment Utility
Ok that worked thanx so much. Let em just wait a day or so to confirm that everything is ok and if something else needs to be added then ill rais the points but for now its 50 and ill give you a grade A because you were a huge help. One more thing though why is it that I you had to add that thing to the javascript to change it to say search CNCG I thought it should work with what the value is for the form? Thanks
0
 
LVL 19

Accepted Solution

by:
dakyd earned 50 total points
Comment Utility
It's because you included the following line in your index.php file:

<script language="JavaScript1.3" type="text/javascript">return_query()</script>

It populates your field with whatever the last query was.  Again, the first time you load a page, there was no "last query", so you get "undefined".  You can remove this line, but thta means that your script won't remember what the last query was anymore.  I assumed that's a feature you want, so I left it alone.  If you don't want that feature or don't care, you can delete that line outright.
0
 

Author Comment

by:sgreeny12
Comment Utility
Ahh that makes sence thanks so much.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now