Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange error 1

Status
Not open for further replies.

annestahl

Technical User
Dec 6, 2002
56
US
Hi,
I'm no programmer, and I'm getting a strange script error on a page I'm redesigning. I didn't write the script and the author cannot fix the problem. Internet Explorer shows the pages loaded but with errors and judging by the line number it appears to be in the 'newsletter sign-up' box. However, when I hit refresh it does not show any errors. Also, I can't figure out what might be wrong with the script, and I usually have a pretty good idea... the page is Can anyone help solve this mystery?
Thanks a mill,
Anne (anne_stahl@yahoo.com)
 
yes, I see that too. Though it's not in the place that causes the error and it didn't seem to fix the error. of course I'm not sure I changed it correctly. Could you take a look at: Thank you so much,
Anne
 
It fixed the error I mentioned. Things aren't lining up properly in Mozilla, but that's an HTML/CSS problem, not a script error. I'm not getting the "loaded but with errors" that you described, either.

So at this point, in Mozilla I see no errors, per se.

I do see the "error" prompt in IE, however.

I see a lot of "bad" HTML. I would suggest that you add stricter doctype, and run it through a validator. For example, you should have quotes around all of your values.

The "onFocus" line looks very strange to me. There isn't a "type" assigned to that input tag:

Code:
<input 
onFocus="if (document '' document.TEPremotesub '' document.TEPremotesub.email '' document.TEPremotesub.email.value == 'your email') document.TEPremotesub.email.value = '';" 
value="your email" name=email size="18">


Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
what kind of type would one need? there is a hidden type earlier...-> Like I said, I don't know Java script... I'm just supposed to give the site a new look, but I just can't live with the error, even if it's not my responsiblity. Plus I'm curious. Have to lean java script some time.

my IE error note is something like
line 282
char 14
error: expected ')'
code 0

make any sense?
thanks so much for your help!!

 
Yes, that's the same error I see.

I think the "type" attribute should be "text". The onfocus value as single ticks where I think it needs a logical pipe, meaning "or".

Like this:

Code:
<input type="text"
onFocus="if (document | document.TEPremotesub | document.TEPremotesub.email | document.TEPremotesub.email.value == 'your email') {document.TEPremotesub.email.value = ''};"
value="your email" name=email size="18">

Try that.


Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 

The problem is that you are using two apostrophe ( '' ) characters instead of two pipe characters ( || ) in your JavaScript.

Hope this helps,
Dan
 
YEAH!!! It works! Thank you Thank you Thank you!!!
The apostrophes...
I also noticed that you changed the <> to {} is that also what was wrong?
 
In JavaScript it is perfectly legal to do:

Code:
if (myVar == myValue) dothis dothat;

However, it is good coding practice to enclose all code bodies in curly braces:

Code:
if (myVar == myValue)
{
  dothis;
  dothat;
}

In other words, all "tests" should be inside parantheses, and all "code bodies" should be inside curly braces.

If you want to thank me, please consider visiting my site, and clicking a few of the ads. You can support Tek-Tips by visiting some of their sponsors, as well.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top