html页面使用embed嵌入*.svg,页面上使用js函数可不可以调用svg内部的js函数?
 
可以,在*.svg中嵌入的js函数上加一句top.*=*,就可以在html页中使用该函数了,例如:
top.show=show;
function show(){
  alert('welcome');
}
 
在HTML中调用SVG中的JS,要注意要在<embed />载入后调用,可以写在<embed />的onload事件中

相关文章:

  • 2022-12-23
  • 2022-02-21
  • 2022-12-23
  • 2021-06-01
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案