Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Jquery将文本分配给iFrame中的标签?_Jquery_Asp.net_Iframe - Fatal编程技术网

如何使用Jquery将文本分配给iFrame中的标签?

如何使用Jquery将文本分配给iFrame中的标签?,jquery,asp.net,iframe,Jquery,Asp.net,Iframe,Iam有两个页面Parent.aspx和Child.aspx 我使用IFrame显示来自家长的my Child.aspx,如下所示 <div id="Omit" class="Omit" style="display:none"> <iframe src="Omission.aspx" width="1000" height="600"></iframe> </div> 我需要将此值指定给Iframe中的标签 我也试过这些

Iam有两个页面Parent.aspx和Child.aspx

我使用IFrame显示来自家长的my Child.aspx,如下所示

  <div id="Omit" class="Omit" style="display:none">
      <iframe src="Omission.aspx" width="1000" height="600"></iframe>
    </div>
我需要将此值指定给Iframe中的标签 我也试过这些方法

  $(".lblOne").text($(".ddlService option:selected").text())
  $(".lblOne").text(Text);
  $('#<%= lblOne.ClientID %>').html(Text)
  $('#<%= lblOne.ClientID %>').text(Text)
$(“.lblOne”).text($(“.ddlService选项:选中”).text()
$(“.lblOne”).text(text);
$('#').html(文本)
$('#')。文本(text)
我无法将文本bing到该标签。。, 有谁能帮我摆脱这个分配的小局面吗, 感谢Advace

试试这个:

// Get the iFrame jQuery Object
var $MyFrame = $("#iframeid");

// You need to wait for the iFrame content to load first
// So, that the click events work properly
$MyFrame.load(function () {
    var frameBody = $MyFrame.contents().find('body');

    // Find the label 
    var $label = frameBody.find('.lblOne');

    // Set the label text
    $label.html(Text);
});

看看我的回答:这比你需要的多一点,但以后可能需要更多。重复:@t.niese,但这里我不是通过Jquery分配iframe,我只想将文本分配到另一页的标签上iframe@Pink看看VimalStan的链接,这是最简单的方法。我链接到的答案是在父对象和iframe之间创建一个干净的接口。
  $(".lblOne").text($(".ddlService option:selected").text())
  $(".lblOne").text(Text);
  $('#<%= lblOne.ClientID %>').html(Text)
  $('#<%= lblOne.ClientID %>').text(Text)
// Get the iFrame jQuery Object
var $MyFrame = $("#iframeid");

// You need to wait for the iFrame content to load first
// So, that the click events work properly
$MyFrame.load(function () {
    var frameBody = $MyFrame.contents().find('body');

    // Find the label 
    var $label = frameBody.find('.lblOne');

    // Set the label text
    $label.html(Text);
});