Javascript in ASP

J

james

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

http://www.jlhufford.com/search_results.asp?txtsearchParamTxt=h20&txtsearchP
aramType=ALL&txtsearchParamCat=25&txtsearchParamMan=ALL&txtsearchParamVen=AL
L&txtDateAddedStart=&txtDateAddedEnd=&txtPriceStart=&txtPriceEnd=&txtFromSea
rch=fromSearch&iLevel=1&btnSearch.x=54&btnSearch.y=12
 
L

Lasse Reichstein Nielsen

james said:
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.

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

<span onmouseover="window.status="CoolText.com"; return true"
onmouseout="window.status=""; return true">

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

<span onmouseover="window.status='CoolText.com'; return true"
onmouseout="window.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(URL,id,'toolbar=1,...,top=184');


(your URL wrapped, here is a non-wrapped version:
<URL:http://www.jlhufford.com/search_res...Search&iLevel=1&btnSearch.x=54&btnSearch.y=12>
)

/L
 
P

Peter

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 said:
james said:
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.

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

<span onmouseover="window.status="CoolText.com"; return true"
onmouseout="window.status=""; return true">

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

<span onmouseover="window.status='CoolText.com'; return true"
onmouseout="window.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(URL,id,'toolbar=1,...,top=184');


(your URL wrapped, here is a non-wrapped version:
<URL:http://www.jlhufford.com/search_results.asp?txtsearchParamTxt=h20&txtse
archParamType=ALL&txtsearchParamCat=25&txtsearchParamMan=ALL&txtsearchParamV
en=ALL&txtDateAddedStart=&txtDateAddedEnd=&txtPriceStart=&txtPriceEnd=&txtFr
omSearch=fromSearch&iLevel=1&btnSearch.x=54&btnSearch.y=12>
)

/L
 
J

james

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 said:
james said:
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.

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

<span onmouseover="window.status="CoolText.com"; return true"
onmouseout="window.status=""; return true">

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

<span onmouseover="window.status='CoolText.com'; return true"
onmouseout="window.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(URL,id,'toolbar=1,...,top=184');


(your URL wrapped, here is a non-wrapped version:
<URL:http://www.jlhufford.com/search_results.asp?txtsearchParamTxt=h20&txtse
archParamType=ALL&txtsearchParamCat=25&txtsearchParamMan=ALL&txtsearchParamV
en=ALL&txtDateAddedStart=&txtDateAddedEnd=&txtPriceStart=&txtPriceEnd=&txtFr
omSearch=fromSearch&iLevel=1&btnSearch.x=54&btnSearch.y=12>
)

/L
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top