my script doesn't work.... sigh!

Discussion in 'Javascript' started by Luca, Feb 2, 2004.

  1. Luca

    Luca Guest

    About one month ago I have inserted in my web site a
    clickcounter who controls the access to almost every link, but this script
    who changed the path in every link so the
    search engines couldn't recognize my links and my web site has lost a lot in
    search engines ranks;
    this is the script:


    <A href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    Target="_blank">
    F.I.A.O.
    </A>

    <p class=notasxinf>
    <script
    src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    &type=js"> <!this script send the number to the counter>
    </script>
    accessi dal 13/12/2003
    </p>

    Last week a person said to me to insert this javascript to solve all off my
    problems (I'm a javascript begginner):


    <a href="http://www.fiao.it" (here I added: target="_blank")
    onclick="self.location.href='http://www.mywebsite.com/cgi-bin/click/go.cgi?h
    ttp://www.fiao.it'; return false">
    FIAO.it </A>
    and to mantein the other script:

    <p class=notasxinf>
    <script
    src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    &type=js"> <!this script send the number to the counter>
    </script>
    accessi dal 13/12/2003
    </p>

    Whith this script though I have added: target="_blank", i couldn't raise to
    have the second window opened so I changed a little the javascript (I'm a
    javascript begginner) in this way:

    <a href="http://www.fiao.it" target="_blank"
    onclick="window.open(self.location.href='http://www.mywebsite.com/cgi-bin/cl
    ick/go.cgi?http://www.fiao.it'; return false)">
    FIAO
    </A>

    at the beginning it looks to work, so I inserted it in almost all my site
    (working hard during two days), but half an hour ago I have discovered it
    doesn't work:
    Now a new window open, but the counter does not count!!!
    Every one can say to me where is the error in this last my script, or better
    which script I need to use to obtain the result to count clicks, to open the
    site in a new window and to left a copy of the link that could be read by
    search engine (possibly without using the noscript tag)?

    thanks lot to every who answer this may question
    bye luca (from Italy).
    Luca, Feb 2, 2004
    #1
    1. Advertising

  2. Luca

    Luca Guest

    Is this so difficult? :)

    "Luca" <> ha scritto nel messaggio
    news:m4wTb.8587$...
    > About one month ago I have inserted in my web site a
    > clickcounter who controls the access to almost every link, but this script
    > who changed the path in every link so the
    > search engines couldn't recognize my links and my web site has lost a lot

    in
    > search engines ranks;
    > this is the script:
    >
    >
    > <A

    href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    > Target="_blank">
    > F.I.A.O.
    > </A>
    >
    > <p class=notasxinf>
    > <script
    >

    src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    > &type=js"> <!this script send the number to the counter>
    > </script>
    > accessi dal 13/12/2003
    > </p>
    >
    > Last week a person said to me to insert this javascript to solve all off

    my
    > problems (I'm a javascript begginner):
    >
    >
    > <a href="http://www.fiao.it" (here I added: target="_blank")
    >

    onclick="self.location.href='http://www.mywebsite.com/cgi-bin/click/go.cgi?h
    > ttp://www.fiao.it'; return false">
    > FIAO.it </A>
    > and to mantein the other script:
    >
    > <p class=notasxinf>
    > <script
    >

    src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    > &type=js"> <!this script send the number to the counter>
    > </script>
    > accessi dal 13/12/2003
    > </p>
    >
    > Whith this script though I have added: target="_blank", i couldn't raise

    to
    > have the second window opened so I changed a little the javascript (I'm a
    > javascript begginner) in this way:
    >
    > <a href="http://www.fiao.it" target="_blank"
    >

    onclick="window.open(self.location.href='http://www.mywebsite.com/cgi-bin/cl
    > ick/go.cgi?http://www.fiao.it'; return false)">
    > FIAO
    > </A>
    >
    > at the beginning it looks to work, so I inserted it in almost all my site
    > (working hard during two days), but half an hour ago I have discovered it
    > doesn't work:
    > Now a new window open, but the counter does not count!!!
    > Every one can say to me where is the error in this last my script, or

    better
    > which script I need to use to obtain the result to count clicks, to open

    the
    > site in a new window and to left a copy of the link that could be read by
    > search engine (possibly without using the noscript tag)?
    >
    > thanks lot to every who answer this may question
    > bye luca (from Italy).
    >
    >
    >
    >
    >
    >
    >
    >
    Luca, Feb 2, 2004
    #2
    1. Advertising

  3. Luca

    @SM Guest

    Luca a ecrit :
    >
    > About one month ago I have inserted in my web site a
    > clickcounter who controls the access to almost every link, but this script
    > who changed the path in every link so the
    > search engines couldn't recognize my links and my web site has lost a lot in
    > search engines ranks;
    > this is the script:
    >
    > <A href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    > Target="_blank">
    > F.I.A.O.
    > </A>
    >
    > <p class=notasxinf>
    > <script
    > src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    > &type=js"> <!this script send the number to the counter>
    > </script>
    > accessi dal 13/12/2003
    > </p>
    >
    > Last week a person said to me to insert this javascript to solve all off my
    > problems (I'm a javascript begginner):
    >
    > <a href="http://www.fiao.it" (here I added: target="_blank")
    > onclick="self.location.href='http://www.mywebsite.com/cgi-bin/click/go.cgi?h
    > ttp://www.fiao.it'; return false">
    > FIAO.it </A>
    > and to mantein the other script:
    >
    > <p class=notasxinf>
    > <script
    > src="http://www.mywebsite.com/cgi-bin/click/stats.cgi?url=http://www.fiao.it
    > &type=js"> <!this script send the number to the counter>
    > </script>
    > accessi dal 13/12/2003
    > </p>
    >
    > Whith this script though I have added: target="_blank", i couldn't raise to
    > have the second window opened so I changed a little the javascript (I'm a
    > javascript begginner) in this way:
    >
    > <a href="http://www.fiao.it" target="_blank"
    > onclick="window.open(self.location.href='http://www.mywebsite.com/cgi-bin/cl
    > ick/go.cgi?http://www.fiao.it'; return false)">
    > FIAO
    > </A>
    >
    > at the beginning it looks to work, so I inserted it in almost all my site
    > (working hard during two days), but half an hour ago I have discovered it
    > doesn't work:
    > Now a new window open, but the counter does not count!!!
    > Every one can say to me where is the error in this last my script, or better
    > which script I need to use to obtain the result to count clicks, to open the
    > site in a new window and to left a copy of the link that could be read by
    > search engine (possibly without using the noscript tag)?
    >
    > thanks lot to every who answer this may question
    > bye luca (from Italy).


    Do not understand why you want to open in a new window ... ? !
    Perhaps is it why it doesn't work ?
    You call a cgi and you don't know how it runs !
    It would be preferable to do not open it in a new window.
    Certainly on fiao.it they have a FAQ about their counter.
    Try to do exactly what they say, before to test other ways ... !

    in your code to open a new window there are some mistakes :

    Correct it like that :

    <a href="http://www.fiao.it" target="_blank"
    onclick="
    window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it');
    return false;">FIAO</A>

    You could try :

    <a href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    target="vinivici" onclick="window.open('','vinivici');">FIAO</A>

    or :

    <a href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    target="vinivici" onclick="window.open('','vinivici','resizable=1,menubar=1');">FIAO</A>

    or (for a full screen) (very not recommanded ! )

    <a href="http://www.mywebsite.com/cgi-bin/click/go.cgi?http://www.fiao.it"
    target="vinivici" onclick="window.open('','vinivici','width='+
    screen.width-26+',height='+screen.height-50+',resizable=1,top=0,left=0');">FIAO</A>

    --
    ******** (enlever/remove [OTER_MOI] du/from reply url) *******
    St├ęphane MORIAUX : mailto:
    Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
    http://perso.wanadoo.fr/stephane.moriaux/internet/
    **************************************************************
    @SM, Feb 3, 2004
    #3
  4. Luca

    Luca Guest

    Thanks lot!!!
    I had already found the solution and it works:

    <a href="http://www.xyzwebsite.com/"
    onclick="window.open('http://mywebsite.com/cgi-bin/click/go.cgi?http://www.x
    yzwebsite.com/'); return false;">
    xyzwebsite</a>

    Can you tell me if this script could have any problem?

    thanks, bye
    Luca
    Luca, Feb 3, 2004
    #4
  5. On Tue, 03 Feb 2004 15:16:07 GMT, Luca <>
    wrote:

    > <a href="http://www.xyzwebsite.com/"
    > onclick="window.open('http://mywebsite.com/cgi-bin/click/go.cgi?http://www.x
    > yzwebsite.com/'); return false;">
    > xyzwebsite</a>
    >
    > Can you tell me if this script could have any problem?


    The window.open() method requires two arguments. The first (which you
    have) is the URI of the document to load. The second is the name of the
    new window, which can be used with the target attribute in links. Even if
    you never intend to use the name, you should supply it - even 'w' would be
    fine. I think some browsers refuse to open the window if you don't.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 3, 2004
    #5
  6. Luca

    Luca Guest


    > The window.open() method requires two arguments. The first (which you
    > have) is the URI of the document to load. The second is the name of the
    > new window, which can be used with the target attribute in links. Even if
    > you never intend to use the name, you should supply it - even 'w' would be
    > fine. I think some browsers refuse to open the window if you don't.



    So the script would be this? ---> (inserting target="_blank")

    <a href="http://www.xyzwebsite.com/" target="_blank"
    onclick="window.open('http://mywebsite.com/cgi-bin/click/go.cgi?http://www.x
    yzwebsite.com/'); return false;">
    xyzwebsite</a>

    if not what could be (sorry i'm a javascript beginner :) )

    thanks, bye

    Luca
    Luca, Feb 3, 2004
    #6
  7. On Tue, 03 Feb 2004 15:48:32 GMT, Luca <>
    wrote:

    > On Tue, 03 Feb 2004 15:19:51 GMT, Michael Winter
    > <> wrote:
    >
    >> The window.open() method requires two arguments. The first (which you
    >> have) is the URI of the document to load. The second is the name of the
    >> new window, which can be used with the target attribute in links. Even
    >> if you never intend to use the name, you should supply it - even 'w'
    >> would be fine. I think some browsers refuse to open the window if you
    >> don't.

    >
    > So the script would be this? ---> (inserting target="_blank")
    >
    > <a href="http://www.xyzwebsite.com/" target="_blank"
    > onclick="window.open('http://mywebsite.com/cgi-bin/click/go.cgi?http://www.x
    > yzwebsite.com/'); return false;">
    > xyzwebsite</a>
    >
    > if not what could be (sorry i'm a javascript beginner :) )


    The HTML is fine. I was referring to the JavaScript call. You currently
    have

    window.open('URL');

    What you need is

    window.open('URL', 'windowName');

    So, using your current example (omitting the URL for clarity), we have:

    <a href="http://www.xyzwebsite.com/"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>

    If you did want to direct a page opened by a link to the new window, you
    could do:

    <a href="http://www.example.com/" target="xyzwebsite">...</a>

    Notice that the values of the target attribute, and the second argument to
    window.open(), are the same.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 3, 2004
    #7
  8. Luca

    Luca Guest

    > Notice that the values of the target attribute, and the second argument to
    > window.open(), are the same.



    So I need to use both target="_Newwindow" and the second argumento of
    window.open ?

    <a href="http://www.xyzwebsite.com/" target="_Newwindow"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>

    or is enough:


    <a href="http://www.xyzwebsite.com/"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>


    And I 've seen a little particular in your script:

    I need to remove the semicolon at the end of the script? ----> ); return
    false;">...</a> to make so (i had read is better to put it there) : ---> );
    return false">..</a>
    thanks, bye
    luca
    Luca, Feb 3, 2004
    #8
  9. Luca

    Luca Guest

    > Notice that the values of the target attribute, and the second argument to
    > window.open(), are the same.



    So I need to use both target="_Newwindow" and the second argumento of
    window.open ?

    <a href="http://www.xyzwebsite.com/" target="_Newwindow"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>

    or is enough:


    <a href="http://www.xyzwebsite.com/"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>


    And I 've seen a little particular in your script:

    I need to remove the semicolon at the end of the script? ----> ); return
    false;">...</a> to make so (i had read is better to put it there) : ---> );
    return false">..</a>
    thanks, bye
    luca
    Luca, Feb 3, 2004
    #9
  10. On Tue, 03 Feb 2004 16:30:15 GMT, Luca <>
    wrote:

    >> Notice that the values of the target attribute, and the second argument
    >> to window.open(), are the same.


    Sorry, I shouldn't have introduced the target attribute to the discussion.

    > So I need to use both target="_Newwindow" and the second argumento of
    > window.open ?
    >
    > <a href="http://www.xyzwebsite.com/" target="_Newwindow"
    > onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>
    >
    > or is enough:
    >
    > <a href="http://www.xyzwebsite.com/"
    > onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>


    The second example (without the target attribute) is sufficient.


    > And I 've seen a little particular in your script:
    >
    > I need to remove the semicolon at the end of the script?


    No, you don't. I just tend to. In an intrinsic event, you don't need to
    include a semi-colon at the end of the last statement, but it is good
    practice to add it. With scripts in general, you should always terminate
    statements with a semi-colon.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 3, 2004
    #10
  11. Luca

    Luca Guest

    I have inserted your suggestion in part of my today work and when I click on
    the links the editor html said there is an error in the script:
    The script I have tried now is this:

    <a href="http://www.assoleader.it" target="_blank"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://w
    ww.assoleader.it', '_blank'); return false;">
    www.Assoleader.it .</A>

    My html editor says there is an error at first letter of the line --->
    onclick=....

    I have also tried without target="_blank" and without the secon argument of
    window.open. in all these cases the editor I use says there is an error in
    javascript code.

    I don't know what to do: now i'm thinking to leave all in the same manner it
    was:

    <a href="http://www.assoleader.it"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://w
    ww.assoleader.it'); return false;">
    www.Assoleader.it .</A>


    bye ,
    Luca
    Luca, Feb 3, 2004
    #11
  12. Luca

    Luca Guest

    Sorry i hadn't read your last message, but I must confirm that my editor
    (first page2000 says theree is an error in the script) also with this kind
    of script (though the script
    works):

    a href="http://www.xyzwebsite.com/"
    onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>

    so i don't know what to do!!?

    thanks all the same,
    Luca
    Luca, Feb 3, 2004
    #12
  13. On Tue, 03 Feb 2004 19:18:33 GMT, Luca <>
    wrote:

    > Sorry i hadn't read your last message, but I must confirm that my editor
    > (first page2000 says theree is an error in the script) also with this
    > kind
    > of script (though the script
    > works):
    >
    > a href="http://www.xyzwebsite.com/"
    > onclick="window.open('theURL', 'xyzwebsite'); return false">...</a>
    >
    > so i don't know what to do!!?


    Create this as a HTML file. Tell me if you have problems with it.

    <html lang="en" dir="ltr">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Test page</title>
    </head>
    <body>
    <div>
    <a href="http://www.google.com/"
    onclick="window.open(this.href,'Google');return false;">test</a>
    </div>
    </body>
    </html>

    Mike

    Just so you know: using this.href as I did above is the same as using
    'http://www.google.com/'

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 3, 2004
    #13
  14. Luca

    Luca Guest

    I have tried what you said, but it looks be the same, but i think what you
    say be the just thing because I have seen my editor tell me there is an
    error when I'm off line (and it cannot tell me what kind of error!), but
    when i'm on line, if I press a link in the editor, the referring web sites
    open in a new window without problems... so i think maybe is a problem of my
    editor.

    I'm courious to understan something of your last message:
    Can i put this href again after the script path, like this:

    <a href="http://www.assoleader.it"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://t
    his.href', 'w'); return false;">
    www.Assoleader.it .</A> ?

    Is it always necessary to put this in the "head" (I hadn't this (but whit,
    or without I have seen no changes are):
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    ?

    However I'm very happy to have found you so patient!
    thanks lot ,
    bye,
    Luca
    Luca, Feb 3, 2004
    #14
  15. Luca

    Luca Guest

    I have tried what you said, but it looks be the same, but i think what you
    say be the just thing because I have seen my editor tell me there is an
    error when I'm off line (and it cannot tell me what kind of error!), but
    when i'm on line, if I press a link in the editor, the referring web sites
    open in a new window without problems... so i think maybe is a problem of my
    editor.

    I'm courious to understan something of your last message:
    Can i put this href again after the script path, like this:

    <a href="http://www.assoleader.it"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://t
    his.href', 'w'); return false;">
    www.Assoleader.it .</A> ?

    Is it always necessary to put this in the "head" (I hadn't this (but whit,
    or without I have seen no changes are):
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    ?

    However I'm very happy to have found you so patient!
    thanks lot ,
    bye,
    Luca
    Luca, Feb 3, 2004
    #15
  16. On Tue, 03 Feb 2004 21:01:50 GMT, Luca <>
    wrote:

    [snip]

    > I'm courious to understan something of your last message:
    > Can i put this href again after the script path, like this:
    >
    > <a href="http://www.assoleader.it"
    > onclick="window.open('http://www.mywebsite.com/cgi-bin/click/go.cgi?http://t
    > his.href', 'w'); return false;">
    > www.Assoleader.it .</A> ?


    Yes, but with a slight difference. this.href yields a string, so you would
    concatenate it. For example,

    <a href="http://www.assoleader.it/"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/
    go.cgi?'+this.href,'w');return false;">www.Assoleader.it</a>

    would be the same as

    <a href="http://www.assoleader.it/"
    onclick="window.open('http://www.mywebsite.com/cgi-bin/click/
    go.cgi?http://www.assoleader.it/','w');return false;">www.ass
    oleader.it</a>

    Line wrapping can be a pain sometimes, can't it. :)

    > Is it always necessary to put this in the "head" (I hadn't this (but
    > whit, or without I have seen no changes are):
    > <meta http-equiv="Content-Script-Type" content="text/javascript">
    > ?


    Strictly, if you use intrinsic events, such as onclick, you should include
    that META element. It indicates the language used in the event code.
    However, most (possibly all) browsers just assume JavaScript anyway so in
    practice it's not really necessary. Because I try to conform to the
    various specifications as best I can, I use that META element nevertheless.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 3, 2004
    #16
  17. Luca

    Luca Guest

    Thanks Mike javascript seems to be very interesting...
    i'm trying to learn it and what you have explained to me was as very
    interesting as to post on this newsgroup.
    If I raise to learn enough this scripting language I would like to utilize
    again this newsgroup: so I can exercize myself in writing english.
    thanks and goodbye (arrivederci... really we say in this case: "a
    risentirci" from "sentire" = to hear),
    bye
    Luca from Italy
    Luca, Feb 3, 2004
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gianni

    Sqlplus - S stops ...sigh !

    Gianni, Jun 17, 2004, in forum: Perl
    Replies:
    4
    Views:
    6,407
    Karel Kubat
    Jul 1, 2004
  2. =?Utf-8?B?c2FtbXk=?=

    asp.net worker does not load up ...SIGH

    =?Utf-8?B?c2FtbXk=?=, Dec 30, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    2,120
    Steven Cheng[MSFT]
    Jan 17, 2005
  3. Glenn J. Christensen

    (sigh)

    Glenn J. Christensen, Jul 6, 2003, in forum: HTML
    Replies:
    5
    Views:
    623
    spaghetti
    Jul 7, 2003
  4. Nate the Capricious

    Java IDEs *Le sigh*

    Nate the Capricious, Apr 26, 2006, in forum: Java
    Replies:
    41
    Views:
    1,444
    Oliver Wong
    May 3, 2006
  5. Victor Bazarov

    [My OT] Sigh...

    Victor Bazarov, Jun 16, 2004, in forum: C++
    Replies:
    0
    Views:
    398
    Victor Bazarov
    Jun 16, 2004
Loading...

Share This Page