SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Oslo, Norway
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    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:

    http://www.ukeavisenledelse.no/

    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:

    http://www.orapp.no/

    (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 = "http://search.eniro.no/partnersearch/search.c?service=PF_FIRMA&partnerID=Ukeavisen%20Ledelse&source=ukeavisenledelse.no&query="+escape(f.query.value);
      proffwindow = window.open(url);
      if (window.focus) { proffwindow.focus() }
      return(false);
    }
    
    function testproffboksSendMedEnter(f,e) {
      keycode = e.keyCode;
      if (keycode == 13) {
        testproffboksSendForm(f);
        return false;
      }
      else
        return true;
    }
    
    // -->
    </script>
    
    <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="orapp.no" />
        </form>
      <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>
        </ul>
    </div>
    Second, I remembered that there's a builtin error console in Firefox, so I've used that and found that for orapp.no 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 09:40. Reason: Adding code


Bookmarks

Posting Permissions

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