SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2003
    Oslo, Norway
    0 Post(s)
    0 Thread(s)

    Question Flabbergastion: Identical script works on one site, but not on another

    I'm a webmaster for a couple of sites. We have a deal with a business search provider, and we're putting a search box on our sites that's supposed to pop up a new window with search results from their site. Working example here:

    The box is the one in the top right named "Proff™ Firmasøk / Bransjesøk". It has been tested and found working in Safari, Firefox (Mac/Win) and IE 7.

    But when the same code is duplicated – and I do mean duplicated, as in "copied and pasted without any modification whatsoever" – and pasted into the other site, it doesn't work, but rather just reloads the page. Non-working example here:

    (The box is in the same position on that site too, btw.)

    I suspect it must have something to do with some other script which is on the latter site and not on the former, but I don't have enough experience with Javascript on the web to know how to start debugging – or even what tools to use.

    So I guess my question is twofold:

    1. Why does it work on one site but not another?

    2. What kind of tool can I, a Mac guy, use to debug this myself another time?

    I have Firebug (of course), but is not proving very useful in this case.

    EDIT: First, here's the code:

    HTML Code:
    <script language="javascript" type="text/javascript">
    function testproffboksSendForm(f) {
      url = ""+escape(f.query.value);
      proffwindow =;
      if (window.focus) { proffwindow.focus() }
    function testproffboksSendMedEnter(f,e) {
      keycode = e.keyCode;
      if (keycode == 13) {
        return false;
        return true;
    // -->
    <div id="proffsokbox">
      <h2 class="proffsoktittel">Proff™ Firmasøk / Bransjesøk:</h2>
      <form method="get" action="javascript:void('');">
        <input id="query" name="query" class="sokfelt" size="10" value="" type="text" onkeypress="return testproffboksSendMedEnter(this.form,event)" ><input name="Submit" class="sokknapp" value="> Søk" type="submit"  onClick="testproffboksSendForm(this.form);" />
        <input type="hidden" name="service" value="PF_FIRMA" />
        <input type="hidden" name="partnerid" value="Okonomisk Rapport" />
        <input type="hidden" name="source" value="" />
      <ul class="profflinks">
          <li><a href="/nyttig/proff/roller" class="profflink1 profflinkfirst">Rollesøk</a></li>
            <li><a href="/nyttig/proff/nyheter" class="profflink1">Nyhetssøk</a></li>
            <li><a href="/nyttig/proff/kart" class="profflink1">Kartsøk</a></li>
            <li><a href="/nyttig/proff/kurs-konferanser" class="profflink2">Kurs-/konferanseplanlegger</a></li>
    Second, I remembered that there's a builtin error console in Firefox, so I've used that and found that for it says "newwindow has no properties". What I don't understand is why this is happening on one site but not the other.
    Last edited by Travholt; Dec 11, 2007 at 08:40. Reason: Adding code

  2. #2
    SitePoint Member
    Join Date
    Sep 2003
    Oslo, Norway
    0 Post(s)
    0 Thread(s)
    Heh, what do they call it, "power of posting"? The increased chance that you find the solution to a problem just after posting about it on a forum.

    Anyway, there is another script, "smsajax.js", which our CMS provider has installed, and in this script there is a function:
    Code JavaScript:
    function open( ){
      document.location = document.location;
    I guess it should be possbile to just rename that.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts