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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseOver ff vs ie 1

Status
Not open for further replies.

PBE3

Programmer
Aug 16, 2007
25
US
Hello....I am doing a simple page that consists of 3 entry fields, one CVV Code, I added a mouseover() which shows a picture...
My problem is that it works fine in FireFox, but when opened in IE it doesnt work.

Can anyone help me...Thanks much...

Code..
<SCRIPT language="JavaScript" src="customerInfo.js"></SCRIPT>
<SCRIPT LANGUAGE=javascript>
<!--
function show()
{

cvvcode.style.visibility = "visible";
cvvcode.style.height="150";
cvvcode.style.width="350"
cvvcode.style.top="310";
cvvcode.style.left="660";
}

function hide()
{
cvvcode.style.visibility = "hidden"
}
//-->
</SCRIPT>
...
<tr>
<td><a OnMouseOver="JavaScript:show()" OnMouseOut="JavaScript:hide()" class="img" ><FONT class="regtext">CVV Code
<br><FONT size="1">(view CCV example)</A></td>
<IMG ID="cvvcode" SRC="cvv.gif" STYLE="position:absolute;visibility:hidden" border="2">
<td colspan="1"><input type="text" name="cvv" size="3" maxlength="3"
onKeyPress= "if ((event.keyCode > 47 && event.keyCode < 58) || (event.keyCode==45)) event.returnValue = true; else event.returnValue = false;">
</td>
</tr>
 
Where to start...

- "event" is a global object available in IE only. You should read up on cross-browser event handling

- Using tables for layout is so wrong, and so old-hat. Read up on using CSS.

- Missing quotes around attributes can only mean your code either has no DOCTYPE, or does not validate. You should read up on both and get your pages to validate.

- Learn to indent your code. It not only makes it easy for you to work with, but others who may need to help you out.

- Read up on the "type" attribute as a replacement for the "language" attribute on the "script" element.

As to your problem, I'm surprised it works in Firefox at all, given you have no unit specifiers (e.g. "px") after your style values, and also your lazy references to IDs that you assume will give you objects. If anything, I'd expect this to work in IE, but fail in Firefox. For this reason, I'd address all of the above points, and if the problem still exists, post back with updated code.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I guess thank you but not. I didnt expect such scrutiny, but that doesnt matter. I didnt post all of the code its part of a a much bigger code and other pages. What I posted is what I thought I was having a problem with. I do have CSS in my code, I do indent, I do have unit specifiers like I said this is PART of my code in which I thought I was having problems with. I figured it out, thank you for your help tho.
 
PBE3, what you conceive as scrutiny would be better received as "constructive criticism". All the things that Dan points out above are things that need addressing in your code. If you are being paid to work on the code that you posted above and/or web development is your profession then these are things that you need to know. It's what separates "good" web programmers from "bad" web programmers. Assuming you take pride in your work/job then it would be in your best interest to take all of Dan's advice to heart.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top