Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Trigger hover pseudo class using javascript?

Reply
Thread Tools

Trigger hover pseudo class using javascript?

 
 
Ciaran
Guest
Posts: n/a
 
      04-28-2010
Hi,
Is it possible to trigger the hover state of an element using
javascript?

What I'd like to do is have the rollover of one element tirgger the
hover state of a different element.

Is it possible without setting up a dummy class and attaching/removing
it dynamically?

Thanks,
Ciarán
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2010
Ciaran wrote:

> Is it possible to trigger the hover state of an element using
> javascript?


There is no "javascript": <http://PointedEars.de/es-matrix>

> What I'd like to do is have the rollover of one element tirgger the
> hover state of a different element.


You better nest those two elements so that it works without scripting.

> Is it possible without setting up a dummy class and attaching/removing
> it dynamically?


Yes, but as for scripted solutions the approach you describe is more
compatible.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 
Reply With Quote
 
 
 
 
John G Harris
Guest
Posts: n/a
 
      04-28-2010
On Wed, 28 Apr 2010 at 04:43:19, in comp.lang.javascript, Thomas
'PointedEars' Lahn wrote:

><http://PointedEars.de/es-matrix>


I had to rescue IE8 with Ctl|Alt|Del to get out of this page. What have
you done ? What is object.js ?

John
--
John Harris

 
Reply With Quote
 
Ry Nohryb
Guest
Posts: n/a
 
      04-28-2010
On Apr 28, 4:43*am, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
>
> (...) There is no "javascript" (...)


This is comp.lang.ecmascript ?
--
Jorge.
 
Reply With Quote
 
Ciaran
Guest
Posts: n/a
 
      04-28-2010
On Apr 28, 11:27*am, Ry Nohryb <(E-Mail Removed)> wrote:
> On Apr 28, 4:43*am, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
> wrote:
>
>
>
> > (...) There is no "javascript" (...)

>
> This is comp.lang.ecmascript ?
> --




Ha ha maybe it's comp.lang.philosophy


So anyway, the answer is no? A pseudo class can't be triggered via JS?
I'm not looking for workarounds - It's more of an interesting idea
than a problem I'm having.

Cheers,
Ciarán

"Do not try and bend the spoon. That's impossible. Instead... only try
to realize the truth... There is no javascript."





 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2010
Andrew Poulos wrote:

> On 28/04/2010 7:59 PM, John G Harris wrote:
>> On Wed, 28 Apr 2010 at 04:43:19, in comp.lang.javascript, Thomas
>> 'PointedEars' Lahn wrote:
>>> <http://PointedEars.de/es-matrix>

>>
>> I had to rescue IE8 with Ctl|Alt|Del to get out of this page.


Sorry. Are you sure you have let it be loaded completely? It has become
quite large, so it may take some time. Which version of IE 8 have you used?
Have you perhaps accessed a previous revision of the Matrix where there were
no problems (then I could consider reverting to that)? TIA.

>> What have you done ?


Nothing deliberately harmful to IE (.

>> What is object.js ?


It is the base library.

> IE 8 on Vista warns that


Does it warn, does it error out, or does it break there?

> Not implemented
> object.js, line 308 character 7


Thank you. Apparently there is a problem with

| if (typeof window != "undefined" && typeof window.onerror != "undefined")
| {
| window.onerror = fHandler;
^
| }

that the feature test could not deal with.

I am using this as a fallback mechanism for exceptions in
jsx.setErrorHandler(). Since this method is called from several others, and
I do not have Windows Vista to test with, could someone possibly provide a
stack trace, or more insight as to why the test would be passed but the
assignment would not work, please? TIA.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2010
Ciaran wrote:

> So anyway, the answer is no?


No, the answer is "depends". Read again.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 
Reply With Quote
 
Ry Nohryb
Guest
Posts: n/a
 
      04-28-2010
On Apr 28, 11:59*am, John G Harris <(E-Mail Removed)> wrote:
> On Wed, 28 Apr 2010 at 04:43:19, in comp.lang.javascript, Thomas
>
> 'PointedEars' Lahn wrote:
> ><http://PointedEars.de/es-matrix>

>
> I had to rescue IE8 with Ctl|Alt|Del to get out of this page. What have
> you done ? What is object.js ?


See ? that's the prove that "javascript frameworks is a disruptive
technology"
--
Jorge.
 
Reply With Quote
 
Ry Nohryb
Guest
Posts: n/a
 
      04-28-2010
On Apr 28, 2:18*pm, Jake Jarvis <(E-Mail Removed)> wrote:
> On 28.04.2010 13:43, wrote Thomas 'PointedEars' Lahn:
>
>
>
>
>
> > Andrew Poulos wrote:

>
> >> On 28/04/2010 7:59 PM, John G Harris wrote:
> >>> On Wed, 28 Apr 2010 at 04:43:19, in comp.lang.javascript, Thomas
> >>> 'PointedEars' Lahn wrote:
> >>>> <http://PointedEars.de/es-matrix>

>
> >>> I had to rescue IE8 with Ctl|Alt|Del to get out of this page.

>
> > Sorry. *Are you sure you have let it be loaded completely? *It has become
> > quite large, so it may take some time. *Which version of IE 8 have you used? *
> > Have you perhaps accessed a previous revision of the Matrix where therewere
> > no problems (then I could consider reverting to that)? *TIA.

>
> >>> What have you done ?

>
> > Nothing deliberately harmful to IE (.

>
> >>> What is object.js ?

>
> > It is the base library.

>
> >> IE 8 on Vista warns that

>
> > Does it warn, does it error out, or does it break there?

>
> >> Not implemented
> >> object.js, line 308 character 7

>
> > Thank you. *Apparently there is a problem with

>
> > | if (typeof window != "undefined" && typeof window.onerror != "undefined")
> > | {
> > | * window.onerror = fHandler;
> > * * ^
> > | }

>
> > that the feature test could not deal with.

>
> > I am using this as a fallback mechanism for exceptions in
> > jsx.setErrorHandler(). *Since this method is called from several others, and
> > I do not have Windows Vista to test with, could someone possibly provide a
> > stack trace, or more insight as to why the test would be passed but the
> > assignment would not work, please? *TIA.

>
> It's also erroring with "Nicht implementiert" (~ "not implemented") in
> Windows XP SP 3, IE 8.0.6001.18702 here.
>
> I'll try to copy the stack trace:
>
> | JScript anonymous function
>
> object.js line 308
>
> | JScript anonymous function
>
> refers to debug.js, line 50 `setErrorHandler();`
>
> | JScript global code
>
> So it appears you can not assign undefined to window.onerror in ie8
>
> the following
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> * * "http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> * <title>window.onerror test</title>
> * <script type="text/javascript">
> * * function foo() {
> * * * window.onerror = undefined;
> * * }
> * </script>
> </head>
> <body onload="foo();">
> * <p>assigning `undefined` to window.onerror</p>
> </body>
> </html>
>
> also fails here


I've seen that before. You can assign null, though.
--
Jorge.
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2010
Jake Jarvis wrote:

> On 28.04.2010 13:43, wrote Thomas 'PointedEars' Lahn:
>> Andrew Poulos wrote:
>>> [http://PointedEars.de/es-matrix]
>>> IE 8 on Vista warns that

>> [...]
>>> Not implemented
>>> object.js, line 308 character 7

>>
>> Thank you. Apparently there is a problem with
>>
>> | if (typeof window != "undefined" && typeof window.onerror !=
>> | "undefined")
>> | {
>> | window.onerror = fHandler;
>> ^
>> | }
>>
>> that the feature test could not deal with.
>>
>> I am using this as a fallback mechanism for exceptions in
>> jsx.setErrorHandler(). Since this method is called from several others,
>> and I do not have Windows Vista to test with, could someone possibly
>> provide a stack trace, or more insight as to why the test would be passed
>> but the
>> assignment would not work, please? TIA.

>
> It's also erroring with "Nicht implementiert" (~ "not implemented") in
> Windows XP SP 3, IE 8.0.6001.18702 here.
>
> I'll try to copy the stack trace:
>
> | JScript anonymous function
>
> object.js line 308
>
> | JScript anonymous function
>
> refers to debug.js, line 50 `setErrorHandler();`
>
> | JScript global code
>
> So it appears you can not assign undefined to window.onerror in ie8
>
> the following [test case] also fails here


Thank you very much! That was the reason, indeed. Although I am setting a
default value if `fError' is (supposedly) not a method, the newly introduced
closure and namespaces change everything as jsx.clearErrorHandler() is not
yet defined when setErrorHandler() is being defined.

var setErrorHandler = jsx.setErrorHandler = (function () {
var
jsx_object = jsx.object,
jsx_clearErrorHandler = jsx.clearErrorHandler;

return function (fHandler) {
// ...

if (!jsx_object.isMethod(fHandler))
{
fHandler = jsx_clearErrorHandler;
}

if (typeof window != "undefined"
&& typeof window.onerror != "undefined")
{
// ...
window.onerror = fHandler;
}

return (typeof window.onerror != "undefined"
&& window.onerror == fHandler);
};
}());

var clearErrorHandler = jsx.clearErrorHandler = function () {
// ...
};

That was also the reason why I was getting this runtime error in Wine-IE 6
(from IEs4Linux), which I previously attributed to a quirk in the new
wine-unstable:

| Line: 419
| Char: 7
| Error: Could not complete the operation due to error 80004001
| Code: 0
| URL: http://[...]/scripts/test/es-matrix

After reversing the order of the declarations, the problem is gone here

With clean browser cache, does anyone still observe problems in IE?


\\//, Live long and prosper

PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$(E-Mail Removed)> (2004)
 
Reply With Quote
 
 
 
Reply

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vertical padding on first-letter pseudo class /w gecko Jonathan N. Little HTML 1 11-02-2005 01:52 AM
Re: Class selector, ID selectors and link pseudo-classes Luigi Donatello Asero HTML 1 06-04-2005 06:58 PM
Class selector, ID selectors and link pseudo-classes Luigi Donatello Asero HTML 4 06-04-2005 05:02 PM
use javascript onmouseover to trigger hover state of another image Elisa Javascript 2 07-11-2004 12:25 AM
add window.status javascript to a:hover css pseudo-class? Bob P. Javascript 2 06-25-2004 05:51 PM



Advertisments