Javascript in ASP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • james

    Javascript in ASP

    Hi. I have a problem with a little javascript to open up a pop-up window in
    my search results page. I get a debug pop-up every time the page loads, and
    I've gone over the code several times, and I can't figure out what's wrong.
    I'm a newbie, though, so that doesn't mean much. I'm doing a lot of work on
    the page now, so the code's kind of sloppy. But, if anyone could take a
    look at the link below and give a suggestion, I'd be a happy Hoosier.
    Thanks in advance,

    James


    aramType=ALL&tx tsearchParamCat =25&txtsearchPa ramMan=ALL&txts earchParamVen=A L
    L&txtDateAddedS tart=&txtDateAd dedEnd=&txtPric eStart=&txtPric eEnd=&txtFromSe a
    rch=fromSearch& iLevel=1&btnSea rch.x=54&btnSea rch.y=12


  • Lasse Reichstein Nielsen

    #2
    Re: Javascript in ASP

    "james" <hologos2357@ho tmail.com> writes:
    [color=blue]
    > Hi. I have a problem with a little javascript to open up a pop-up window in
    > my search results page. I get a debug pop-up every time the page loads, and
    > I've gone over the code several times, and I can't figure out what's wrong.
    > I'm a newbie, though, so that doesn't mean much. I'm doing a lot of work on
    > the page now, so the code's kind of sloppy. But, if anyone could take a
    > look at the link below and give a suggestion, I'd be a happy Hoosier.[/color]

    The error is "syntax error, line 466"
    Line 466 contains:

    <span onmouseover="wi ndow.status="Co olText.com"; return true"
    onmouseout="win dow.status=""; return true">

    Here you are using the double-quotes twice. Change it to:

    <span onmouseover="wi ndow.status='Co olText.com'; return true"
    onmouseout="win dow.status=''; return true">

    (Is the "return true" necessary?)


    On the same line you have a javascript:-link, which is bad for many
    reasons (<URL:http://jibbering.com/faq/>).


    You also use "eval" where it is not needed:
    This code:

    eval("page" + id + " = window.open(URL , '" + id + "', 'toolbar=1,...' );");

    can be written without eval as:

    window["page"+id]=window.open(UR L,id,'toolbar=1 ,...,top=184');


    (your URL wrapped, here is a non-wrapped version:
    <URL:http://www.jlhufford.c om/search_results. asp?txtsearchPa ramTxt=h20&txts earchParamType= ALL&txtsearchPa ramCat=25&txtse archParamMan=AL L&txtsearchPara mVen=ALL&txtDat eAddedStart=&tx tDateAddedEnd=& txtPriceStart=& txtPriceEnd=&tx tFromSearch=fro mSearch&iLevel= 1&btnSearch.x=5 4&btnSearch.y=1 2>
    )

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Peter

      #3
      Re: Javascript in ASP

      The return true is necessary. It is related to the event model. If you don't
      specify return true, then the window status is automatically defaulted to
      the action of the link.

      Peter.

      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
      news:ptk9swzq.f sf@hotpop.com.. .[color=blue]
      > "james" <hologos2357@ho tmail.com> writes:
      >[color=green]
      > > Hi. I have a problem with a little javascript to open up a pop-up[/color][/color]
      window in[color=blue][color=green]
      > > my search results page. I get a debug pop-up every time the page loads,[/color][/color]
      and[color=blue][color=green]
      > > I've gone over the code several times, and I can't figure out what's[/color][/color]
      wrong.[color=blue][color=green]
      > > I'm a newbie, though, so that doesn't mean much. I'm doing a lot of[/color][/color]
      work on[color=blue][color=green]
      > > the page now, so the code's kind of sloppy. But, if anyone could take a
      > > look at the link below and give a suggestion, I'd be a happy Hoosier.[/color]
      >
      > The error is "syntax error, line 466"
      > Line 466 contains:
      >
      > <span onmouseover="wi ndow.status="Co olText.com"; return true"
      > onmouseout="win dow.status=""; return true">
      >
      > Here you are using the double-quotes twice. Change it to:
      >
      > <span onmouseover="wi ndow.status='Co olText.com'; return true"
      > onmouseout="win dow.status=''; return true">
      >
      > (Is the "return true" necessary?)
      >
      >
      > On the same line you have a javascript:-link, which is bad for many
      > reasons (<URL:http://jibbering.com/faq/>).
      >
      >
      > You also use "eval" where it is not needed:
      > This code:
      >
      > eval("page" + id + " = window.open(URL , '" + id + "',[/color]
      'toolbar=1,...' );");[color=blue]
      >
      > can be written without eval as:
      >
      > window["page"+id]=window.open(UR L,id,'toolbar=1 ,...,top=184');
      >
      >
      > (your URL wrapped, here is a non-wrapped version:
      >[/color]
      <URL:http://www.jlhufford.com/search_resu...mTxt=h20&txtse
      archParamType=A LL&txtsearchPar amCat=25&txtsea rchParamMan=ALL &txtsearchParam V
      en=ALL&txtDateA ddedStart=&txtD ateAddedEnd=&tx tPriceStart=&tx tPriceEnd=&txtF r
      omSearch=fromSe arch&iLevel=1&b tnSearch.x=54&b tnSearch.y=12>[color=blue]
      > )
      >
      > /L
      > --
      > Lasse Reichstein Nielsen - lrn@hotpop.com
      > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      > 'Faith without judgement merely degrades the spirit divine.'[/color]


      Comment

      • james

        #4
        Re: Javascript in ASP

        Wow! Thanks for all the help. I will likely replace the code without eval
        too. Also, sorry about the link being so long; it's my first time posting
        here. I should have just posed the shorter detail page link. Thanks again,
        I've been struggling with that for a loooong time!

        James

        "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
        news:ptk9swzq.f sf@hotpop.com.. .[color=blue]
        > "james" <hologos2357@ho tmail.com> writes:
        >[color=green]
        > > Hi. I have a problem with a little javascript to open up a pop-up[/color][/color]
        window in[color=blue][color=green]
        > > my search results page. I get a debug pop-up every time the page loads,[/color][/color]
        and[color=blue][color=green]
        > > I've gone over the code several times, and I can't figure out what's[/color][/color]
        wrong.[color=blue][color=green]
        > > I'm a newbie, though, so that doesn't mean much. I'm doing a lot of[/color][/color]
        work on[color=blue][color=green]
        > > the page now, so the code's kind of sloppy. But, if anyone could take a
        > > look at the link below and give a suggestion, I'd be a happy Hoosier.[/color]
        >
        > The error is "syntax error, line 466"
        > Line 466 contains:
        >
        > <span onmouseover="wi ndow.status="Co olText.com"; return true"
        > onmouseout="win dow.status=""; return true">
        >
        > Here you are using the double-quotes twice. Change it to:
        >
        > <span onmouseover="wi ndow.status='Co olText.com'; return true"
        > onmouseout="win dow.status=''; return true">
        >
        > (Is the "return true" necessary?)
        >
        >
        > On the same line you have a javascript:-link, which is bad for many
        > reasons (<URL:http://jibbering.com/faq/>).
        >
        >
        > You also use "eval" where it is not needed:
        > This code:
        >
        > eval("page" + id + " = window.open(URL , '" + id + "',[/color]
        'toolbar=1,...' );");[color=blue]
        >
        > can be written without eval as:
        >
        > window["page"+id]=window.open(UR L,id,'toolbar=1 ,...,top=184');
        >
        >
        > (your URL wrapped, here is a non-wrapped version:
        >[/color]
        <URL:http://www.jlhufford.com/search_resu...mTxt=h20&txtse
        archParamType=A LL&txtsearchPar amCat=25&txtsea rchParamMan=ALL &txtsearchParam V
        en=ALL&txtDateA ddedStart=&txtD ateAddedEnd=&tx tPriceStart=&tx tPriceEnd=&txtF r
        omSearch=fromSe arch&iLevel=1&b tnSearch.x=54&b tnSearch.y=12>[color=blue]
        > )
        >
        > /L
        > --
        > Lasse Reichstein Nielsen - lrn@hotpop.com
        > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        > 'Faith without judgement merely degrades the spirit divine.'[/color]


        Comment

        Working...