Reputation: 3057
I'm having a lot of problems with IE7/IE8 and Javascript/jQuery, which I don't have in Chrome or FireFox.
I have this Javascript function:
function changeImg(img,bla){
$('#open_case').css("background-image", "url('"+img+"')");
getIngo(bla);
navigation_image(bla);
}
And this is my onclick function:
<div class="cImage" style="background-image:url('http://bla.com/images/this_image.jpg');" onclick="changeImg('http://bla.com/images/this_image.jpg','2');"></div>
But it's like the function isn't called at all, 'cause if I change the changeImg function to an alert function:
function changeImg(img,bla){
alert('hi!');
}
It still doesn't work.
The only error IE7/IE8 gives is Expecting Object
(roughly translated)
What am I doing wrong?
Thanks in advance!
[Edit:]
These are lines IE7/IE8 is pointing at;
<script type="text/javascript" src="Scripts/swfobject.js"></script>
<script type="application/javascript" language="javascript">
function clearText(textfield){
if (textfield.defaultValue == textfield.value){
textfield.value = '';
$(textfield).css('color','#000000');
}
}
function addText(textfield){
if (textfield.value == ''){
textfield.value = textfield.defaultValue;
$(textfield).css('color','#999999');
}
}
Upvotes: 0
Views: 2095
Reputation: 6825
If the error is object expected. Then try this
Change your
<script type="application/javascript" language="javascript">
To
<script type="text/javascript">
Upvotes: 3
Reputation: 14798
Is there a reason you're using javascript here? It looks like you're changing the image on a navigation item? You could just just the CSS :hover classes. Regardless, using onmouseover isn't really the "proper" way to be handling this sort of thing in javascript, if you really cannot use just CSS, at the very least look into handling the mouse over envent properly in jQuery.
Upvotes: 2