Poor behavior for simple script in IE7

This is a discussion on "Poor behavior for simple script in IE7" within the JavaScript Forum section. This forum, and the thread "Poor behavior for simple script in IE7 are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 28th, 2007, 12:08
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Poor behavior for simple script in IE7

I have this simple script to preload a rollover button graphic and change buttons on mouseover. This is a submit button for a form. As you can see it's in XHTML.

Code: Select all
<head>
<script type="text/javascript">
<![CDATA[
  pic1= new Image(54,54); 
  pic1.src="./images/submit3_over.gif"; 
  
  pic2 = new Image(54, 54);
  pic2.src"./images/submit3.gif"; 
]]>
</script>
</head>

<body>
form here
<div class="tac">                        
<input type="submit" class="submitd2" name="go" value=" " 
onmouseover="this.className='submite2'" 
onmouseout="this.className='submitd2'" />
end form
         </div><div class="clear"></div>
The css is:
Code: Select all
.submitd2 {
    height: 54px;
    width: 54px;
    margin: 0 0 0 45px;
    float: left;
    position: relative;
    top: -9px;
    background: #becbcc url(./images/submit3.gif);
    border-width: 0;
}
.submite2  {
    height: 54px;
    width: 54px;
    margin: 0 0 0 45px;
    float: left;
    position: relative;
    top: -9px;
    background: #becbcc url(./images/submit3_over.gif);
    border-width: 0;
}
This works flawlessly in Firefox. In IE7, however, the rollover is balky and I don't get the image for a half second after rollover or mouseout. Not just the first time either -- I get a brown box grapic and a slow response, where neither image is present.

Any ideas?

P.S. The image has to be in the background because this is a submit button, not an <a> link.
Here's a link if you want to see it. Try it in IE7. http://www.dhreport.com/test_interactive/ezform.php

Last edited by masonbarge; Jan 28th, 2007 at 14:39. Reason: add link
Reply With Quote

  #2 (permalink)  
Old Jan 28th, 2007, 20:37
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Poor behavior for simple script in IE7

Maybe a custom version of the background switch method?

http://www.newguyinennis.com/samples/css_hover/
Reply With Quote
  #3 (permalink)  
Old Jan 30th, 2007, 12:49
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Poor behavior for simple script in IE7

iirc, IE won't support a css background rollover on a submit button.

It doesn't look like the image is getting preloaded even in Firefox, sigh. Any hints? I moved the source code to an external file -- no help.
Reply With Quote
  #4 (permalink)  
Old Jan 30th, 2007, 16:41
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Poor behavior for simple script in IE7

It might be a stretch, but try putting your snippet of JavaScript in an external file without the CDATA bits.
Reply With Quote
  #5 (permalink)  
Old Feb 5th, 2007, 16:19
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Poor behavior for simple script in IE7

Quote:
Originally Posted by masonbarge View Post
pic2.src"./images/submit3.gif";
D'OH

Amazing what a basic proofread of a script will do.
Working fine now.
Reply With Quote
Reply

Tags
submit, rollover, form, buttons

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple reloader script - please help whitebear654 Starting Out 1 May 5th, 2008 21:33
Poor Audio Quality with Flash .mp3; how do I make .mp3 play automatically? BlackReef Flash & Multimedia Forum 7 Jun 28th, 2007 21:58
Simple PHP login script help Aaron1988 PHP Forum 7 Aug 23rd, 2006 23:38
Poor text rendering in graphics masonbarge Graphics and 3D 7 Apr 27th, 2006 15:36
Weird Opacity behavior in PS 7 autumn_whispers2me Graphics and 3D 0 May 3rd, 2005 22:24


All times are GMT. The time now is 10:22.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43