I need to alter a <style>
from the client-side - something like this:
<head>
<style>
img.Bordered
{ border-style: dashed;
}
</style>
<script type开发者_C百科="text/javascript">
function OnBorderChanged () {
//Set "border-style" to "solid" for Bordered images.
}
</script>
</head>
What is the process for this?
See: http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript and http://www.quirksmode.org/dom/changess.html
These articles explain how to dynamically add and remove entire styles.
Note that the first article give you a pretty good cross-browser set of functions to use. The quirksmode article basically explains how it all works.
using jquery's css method:
http://api.jquery.com/css/
e.g:
$("img.Bordered").css('border-style', 'solid');
精彩评论