By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,545 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

Javascript in ASP

P: n/a
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_resu...h20&txtsearchP
aramType=ALL&txtsearchParamCat=25&txtsearchParamMa n=ALL&txtsearchParamVen=AL
L&txtDateAddedStart=&txtDateAddedEnd=&txtPriceStar t=&txtPriceEnd=&txtFromSea
rch=fromSearch&iLevel=1&btnSearch.x=54&btnSearch.y =12
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"james" <ho*********@hotmail.com> writes:
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&txtsearch ParamType=ALL&txtsearchParamCat=25&txtsearchParamM an=ALL&txtsearchParamVen=ALL&txtDateAddedStart=&tx tDateAddedEnd=&txtPriceStart=&txtPriceEnd=&txtFrom Search=fromSearch&iLevel=1&btnSearch.x=54&btnSearc h.y=12>
)

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

P: n/a
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" <lr*@hotpop.com> wrote in message
news:pt**********@hotpop.com...
"james" <ho*********@hotmail.com> writes:
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_resu...mTxt=h20&txtse
archParamType=ALL&txtsearchParamCat=25&txtsearchPa ramMan=ALL&txtsearchParamV
en=ALL&txtDateAddedStart=&txtDateAddedEnd=&txtPric eStart=&txtPriceEnd=&txtFr
omSearch=fromSearch&iLevel=1&btnSearch.x=54&btnSea rch.y=12> )

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

Jul 20 '05 #3

P: n/a
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" <lr*@hotpop.com> wrote in message
news:pt**********@hotpop.com...
"james" <ho*********@hotmail.com> writes:
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_resu...mTxt=h20&txtse
archParamType=ALL&txtsearchParamCat=25&txtsearchPa ramMan=ALL&txtsearchParamV
en=ALL&txtDateAddedStart=&txtDateAddedEnd=&txtPric eStart=&txtPriceEnd=&txtFr
omSearch=fromSearch&iLevel=1&btnSearch.x=54&btnSea rch.y=12> )

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

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.