UIWebView.使用javascript替换css属性

UIWebView. Replace css properties using javascript

本文关键字:css 属性 替换 javascript 使用 UIWebView      更新时间:2023-09-26

代码如下:

<style type='"text/css'">
html{background: #000; margin: 0; padding: 0}
body {padding: 30px; background: #000;width: 85;margin:0 auto;color: #000;font-family: Arial, sans-serif;line-height: 1.3em;}
</style>

如果我想替换例如html.background该怎么办?

通常的NSString替换是不合适的,因为可能有很多类似的属性

你应该考虑使用jQuery框架。

更多关于jQuery的CSS信息可以在这里找到:http://api.jquery.com/css/