HighDots Forums  

Safari and className oddity?

Javascript JavaScript language (comp.lang.javascript)


Discuss Safari and className oddity? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Geoff Cox
 
Posts: n/a

Default Safari and className oddity? - 06-14-2008 , 04:03 PM






Hello,

Any idea why with the Safari browser you have to move the mouse cursor
in order for the style to change using

document.getElementById('div1').className = 'visibleDiv2';

?!


Cheers,

Geoff

Reply With Quote
  #2  
Old   
SAM
 
Posts: n/a

Default Re: Safari and className oddity? - 06-14-2008 , 05:10 PM






Geoff Cox a écrit :
Quote:
Hello,

Any idea why with the Safari browser you have to move the mouse cursor
in order for the style to change using

document.getElementById('div1').className = 'visibleDiv2';
what is the context ?

onmouseover ?
onclick ?
onchange ?
.... ?

if(confirm('blah')) doc...; ?

--
sm


Reply With Quote
  #3  
Old   
Tom Cole
 
Posts: n/a

Default Re: Safari and className oddity? - 06-14-2008 , 08:38 PM



On Jun 14, 5:03*pm, Geoff Cox <g... (AT) freeuk (DOT) notcom> wrote:
Quote:
Hello,

Any idea why with the Safari browser you have to move the mouse cursor
in order for the style to change using

document.getElementById('div1').className = 'visibleDiv2';

?!

Cheers,

Geoff
I've not experienced that behaviour using Safari 3 for windows. Which
version of Safari are you running and on which OS?


Reply With Quote
  #4  
Old   
Geoff Cox
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 12:37 AM



On Sun, 15 Jun 2008 00:10:45 +0200, SAM
<stephanemoriaux.NoAdmin (AT) wanadoo (DOT) fr.invalid> wrote:

Quote:
Geoff Cox a écrit :
Hello,

Any idea why with the Safari browser you have to move the mouse cursor
in order for the style to change using

document.getElementById('div1').className = 'visibleDiv2';

what is the context ?
The html

<div id="test1" class="visibleDiv2">
<h3>Test 1:</h3>
<IMG alt="image" id="a10" src="../assets/images/play1.gif"
onclick="musicSelect(this);">
</div>
<div id="test11" class="hiddenDiv2">
<IMG alt="image" id="a11" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();">
<IMG alt="image" id="a12" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();">
</div>

<div id="test2" class="hiddenDiv2">
<h3><em>Test 2:</em></h3>
<IMG alt="image" id="a20" src="../assets/images/play1.gif"
onclick="musicSelect(this);">
</div>
<div id="test21" class="hiddenDiv2">
<IMG alt="image" id="a21" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();">
<IMG alt="image" id="a22" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();">
</div>

etc

onclick() in the first block calls musicSelect(this)

function musicSelect(what) {

if (egfinished2 != 'yes') {
alert('Click again once the last sound above has finished');
return;
}

t = what.id.substring(1,2);
what.onclick = '';
what.src = played.src;
soundManager.createSound({
id:'mySound'+t,
url:'../assets/audio-new/Track' + (+t) + '.mp3',
onfinish:function(){document.getElementById('test' +t+1).className =
'visibleDiv2'} });
soundManager.play('mySound'+t);
count++;
}

when the sound is finished

document.getElementById('test'+t+1).className = 'visibleDiv2'

and it is now that the mouse has to be moved to get the .className =
'visibleDiv2' to work. I have also tried .style.display etc and no
different.

Cheers

Geoff


Reply With Quote
  #5  
Old   
Geoff Cox
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 12:39 AM



On Sat, 14 Jun 2008 18:38:43 -0700 (PDT), Tom Cole <tcole6 (AT) gmail (DOT) com>
wrote:

Quote:
On Jun 14, 5:03*pm, Geoff Cox <g... (AT) freeuk (DOT) notcom> wrote:
Hello,

Any idea why with the Safari browser you have to move the mouse cursor
in order for the style to change using

document.getElementById('div1').className = 'visibleDiv2';

?!

Cheers,

Geoff

I've not experienced that behaviour using Safari 3 for windows. Which
version of Safari are you running and on which OS?
Tom,

Safari is v3.1.1 (525.17) for Windows (XP Pro).

Please see my reply to SAM for more details re the context.

Cheers

Geoff


Reply With Quote
  #6  
Old   
SAM
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 09:18 AM



Geoff Cox a écrit :

Didn't try but following what you say : move the mouse,
it seems that Safari keeps focus on the clicked image
and avoid the changing

see bellow

Quote:
div id="test1" class="visibleDiv2"
h3>Test 1:</h3
IMG alt="image" id="a10" src="../assets/images/play1.gif"
onclick="musicSelect(this);"
/div
div id="test11" class="hiddenDiv2"
IMG alt="image" id="a11" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();"
IMG alt="image" id="a12" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();"
/div

div id="test2" class="hiddenDiv2"
h3><em>Test 2:</em></h3
IMG alt="image" id="a20" src="../assets/images/play1.gif"
onclick="musicSelect(this);"
/div
div id="test21" class="hiddenDiv2"
IMG alt="image" id="a21" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();"
IMG alt="image" id="a22" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();"
/div

etc

onclick() in the first block calls musicSelect(this)

function musicSelect(what) {

if (egfinished2 != 'yes') {
alert('Click again once the last sound above has finished');
return;
}

t = what.id.substring(1,2);
what.onclick = '';
what.src = played.src;
soundManager.createSound({
id:'mySound'+t,
url:'../assets/audio-new/Track' + (+t) + '.mp3',
onfinish:function(){document.getElementById('test' +t+1).className =
'visibleDiv2'} });
soundManager.play('mySound'+t);
count++;
// perhaps here :
what.blur();

Quote:
}

when the sound is finished

document.getElementById('test'+t+1).className = 'visibleDiv2'

and it is now that the mouse has to be moved to get the .className =
'visibleDiv2' to work. I have also tried .style.display etc and no
different.
If the blur() up there doesn't work, try :

onfinish: function() {
document.getElementById('test'+t+1).focus();
// or probably better ... :
// location='#test'+t+1;
document.getElementById('test'+t+1).className = 'visibleDiv2';
}
});


--
sm


Reply With Quote
  #7  
Old   
Geoff Cox
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 11:46 AM



On Sun, 15 Jun 2008 16:18:33 +0200, SAM
<stephanemoriaux.NoAdmin (AT) wanadoo (DOT) fr.invalid> wrote:

Quote:
Geoff Cox a écrit :

Didn't try but following what you say : move the mouse,
it seems that Safari keeps focus on the clicked image
and avoid the changing

see bellow

div id="test1" class="visibleDiv2"
h3>Test 1:</h3
IMG alt="image" id="a10" src="../assets/images/play1.gif"
onclick="musicSelect(this);"
/div
div id="test11" class="hiddenDiv2"
IMG alt="image" id="a11" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();"
IMG alt="image" id="a12" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();"
/div

div id="test2" class="hiddenDiv2"
h3><em>Test 2:</em></h3
IMG alt="image" id="a20" src="../assets/images/play1.gif"
onclick="musicSelect(this);"
/div
div id="test21" class="hiddenDiv2"
IMG alt="image" id="a21" src="../assets/images/mypitch1.gif"
onclick="checkThisFirst();"
IMG alt="image" id="a22" src="../assets/images/notmypitch1.gif"
onclick="checkThisSecond();"
/div

etc

onclick() in the first block calls musicSelect(this)

function musicSelect(what) {

if (egfinished2 != 'yes') {
alert('Click again once the last sound above has finished');
return;
}

t = what.id.substring(1,2);
what.onclick = '';
what.src = played.src;
soundManager.createSound({
id:'mySound'+t,
url:'../assets/audio-new/Track' + (+t) + '.mp3',
onfinish:function(){document.getElementById('test' +t+1).className =
'visibleDiv2'} });
soundManager.play('mySound'+t);
count++;

// perhaps here :
what.blur();

}

when the sound is finished

document.getElementById('test'+t+1).className = 'visibleDiv2'

and it is now that the mouse has to be moved to get the .className =
'visibleDiv2' to work. I have also tried .style.display etc and no
different.

If the blur() up there doesn't work, try :

onfinish: function() {
document.getElementById('test'+t+1).focus();
// or probably better ... :
// location='#test'+t+1;
document.getElementById('test'+t+1).className = 'visibleDiv2';
}
});
I have tried all 3 and still the same - I have to move the mouse
cursor to get any action!?

Cheers,

Geoff


Reply With Quote
  #8  
Old   
SAM
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 12:40 PM



Geoff Cox a écrit :
Quote:
I have tried all 3 and still the same - I have to move the mouse
cursor to get any action!?
As I will not install soundManager and muszicks
my test in Safari can't show me your problem,
the click does click and 2nd image appears.

put your page on a server.


--
sm


Reply With Quote
  #9  
Old   
Geoff Cox
 
Posts: n/a

Default Re: Safari and className oddity? - 06-15-2008 , 12:59 PM



On Sun, 15 Jun 2008 19:40:19 +0200, SAM
<stephanemoriaux.NoAdmin (AT) wanadoo (DOT) fr.invalid> wrote:

Quote:
Geoff Cox a écrit :

I have tried all 3 and still the same - I have to move the mouse
cursor to get any action!?

As I will not install soundManager and muszicks
my test in Safari can't show me your problem,
the click does click and 2nd image appears.

put your page on a server.
will do and will email you with the link.

Cheers

Geoff


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.