Lak*_*erw 2 css delphi twebbrowser
我想知道是否有可能操纵网站的CSS.例如输入字段中的颜色?我看了几个问题,但是如果可能的话,我还不清楚.
例如,在谷歌浏览器中,每当选择一个字段时,它会在外部显示一条黄金线.是否有可能在delphi中使用任何网站执行此操作和其他操作.编写应用于Twebbrowser中的网站opend的CSS代码?仅供个人观看
谢谢
我也可以使用此代码更改输入字段背景的颜色吗?我可以更改背景颜色并更改字体大小,但似乎无法找到输入字段的颜色或边框.这是代码:
在页面加载后,可以通过从代码添加样式表来修改CSS:
var
document: IHTMLDocument2;
stylesheet: IHTMLStyleSheet;
stylesheetIndex: Integer;
begin
// Inject CSS Style Sheets
document := webBrowser1.Document as IHTMLDocument2;
stylesheetIndex := document.styleSheets.length;
if stylesheetIndex > 31 then
raise Exception.Create('Already have the maximum amount of CSS stylesheets');
stylesheet := document.createStyleSheet('', stylesheetIndex);
stylesheet.cssText := ...
Run Code Online (Sandbox Code Playgroud)