【问题标题】:Change Source of Iframe from Vb Script从 Vb 脚本更改 iframe 的源
【发布时间】:2023-04-01 16:24:01
【问题描述】:

我需要能够从 VBScript 声明 Iframe 的来源。Iframe 在脚本之外声明

I 框架 Synatx:

<iframe  src ="" runat ="server" id="iframepdf" scrolling="auto"  align= "middle" 
marginheight="10px" width="1400px" height="700px"> 
</iframe>

我的代码:-

<asp:Content ID="content" ContentPlaceHolderID="content" Runat="Server">
<td>
<iframe  src ="" runat ="server" id="iframepdf" scrolling="auto"  align= "middle"     
 marginheight="10px" width="1400px" height="700px"> 
 </iframe>
 </td>
<script language="vbscript" type="text/vbscript">
dim srcofiframe
</script>

我试过 Document.getElementById("Iframepdf").src=srcofiframe -> 没用

【问题讨论】:

    标签: iframe vbscript getelementbyid


    【解决方案1】:

    需要修改&lt;iframe&gt;src属性:

    Dim srcofiframe
    srcofiframe = "http://www.example.com/"
    document.getElementById("iframepdf").src = srcofiframe
    

    【讨论】:

    • @ Ansgr :执行上述操作时出现此错误。我已经在脚本之外声明了 iframe。我需要在脚本中发送 iframe 的来源。 Microsoft VBScript 运行时错误:'Objectrequired: 'document.getElementByID(...)'
    【解决方案2】:

    如果您使用 JavaScript,那么 .src 是前进的方向,但是在 VBScript 中调用时会出错。如果您正在编写您使用的 .vbs:

    设置 oIE = CreateObject("InternetExplorer.Application") oIE.导航“”

    我的项目在 .hta 中,我应用了相同的逻辑:

    iframepdf.Navigate ""

    这是一种享受。请注意,我将其称为声明,因此不需要 '()'。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-26
      • 2014-06-21
      • 1970-01-01
      相关资源
      最近更新 更多