How to test JavaScript in CSS?
Jan 20
When Explorer and Opera parsing the CSS file, encounter the JavaScript and execute it. Browsers execute it only once, though, so if you’d repeat the background-image: etc for another class or id, you still see one alert only.
So Lets Try this:
1 2 3 4 | #Example { border: 1px solid #000000; padding: 10px; background-image: url('javascript:alert(\'It works\');') |
or
1 | background-image: url('javascript:alert('It works');') |