TinyMCE iframe无法通过JS文件选择

时间:2018-11-04 05:28:07

标签: javascript iframe jquery-selectors tinymce domdocument

TinyMCE iframe无法通过JS文件选择。

$(document).ready(function() {
    console.log("Connected!!");
    let iframe = document.getElementById("myTextarea_ifr");
    let body = iframe.contentWindow.document.querySelector("#tinymce");

    body.innerHTMl = localStorage["body111"] || '<p><strong>2</strong> PROGRAM CURRICULUM AND TEACHING ­ LEARNING PROCESSES (120) <br><strong>2.1</strong> Program Curriculum (20) <br><strong>2.1.1</strong> State the process used to identify extent of compliance of the University curriculum for attaining the Program Outcomes and Program Specific Outcomes as mentioned in AnnexureI. Also mention the identified curricular gaps, if any <br>Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=22) <br>(State the process details; also mention identified curricular gaps). <br><strong>Note</strong> : In case all POs are being demonstrably met through University Curriculum then 2.1.2 will not be applicable and the weightage of 2.1.1 will be 20.</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.1.2</strong> State the delivery details of the content beyond the syllabus for the attainment of POs and PSOs (10) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=23) <br>(Provide details of the additional course/ learning material/ content/ laboratory experiments/ projects etc., arising from the gaps identified in 2.1.1 in a tabular form in the format given below) <br><strong>Note</strong> : Please mention in detail whether the Institution has given such inputs and suggestions to the Affiliating University regarding curricular gaps and possible addition of new content/ add­on courses in the curriculum, to bridge the gap and to better attain <br>program outcome(s).</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.2</strong> Teaching ­ Learning Processes (100) <br><strong>2.2.1</strong> Describe processes followed to improve quality of Teaching &amp; Learning (25) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=24) <br>(Processes may include adherence to academic calendar and improving instruction methods using pedagogical initiatives such as real world examples, collaborative learning, quality of laboratory experience with regard to conducting experiments, recording <br>observations, analysis of data etc. encouraging bright students, assisting weak students etc. The implementation details and impact analysis need to be documented)</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.2.2</strong> Quality of internal semester Question papers, Assignments and Evaluation (20) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=25) <br>(Mention the initiatives, implementation details and analysis of learning levels related to quality of semester question papers, assignments and evaluation)</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.2.3</strong> Quality of student projects (25) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=26) <br>(Quality of the project is measured in terms of consideration to factors including, but not limited to, environment, safety, ethics, cost, type(application, product, research, review etc.) and standards. Processes related to project identification, allotment, <br>continuous monitoring, evaluation including demonstration of working prototypes and enhancing the relevance of projects. Mention Implementation details including details.</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.2.4</strong> Initiative related to industry interaction (15) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=27) <br>(Give details of the industry involvement in the program such as industry­attached laboratories, partial delivery of appropriate courses by industry experts etc.&nbsp;</p><p><br></p><p><img class="mce-pagebreak" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-mce-resize="false" data-mce-placeholder=""></p><p><br></p><p><strong>2.2.5</strong> Initiative related to industry internship/summer training (15) Open Seperately (SARUGTireIITemplateRevisedQuestion.aspx?Appid=1660&amp;Progid=558&amp;QuestID=28) <br>(Mention the initiatives, implementation details and impact analysis)</p>'

    setInterval(function() {
        localStorage["body111"] = body.innerHTMl;
    }, 10);
});

在控制台中,当我运行iframe时,我不确定。然后,当我在控制台中运行let iframe = document.getElementById("myTextarea_ifr");时,iframe被iframe对象初始化。我知道文件已连接,因为由于第一行Connected!!,我确实在控制台中收到消息console.log("Connected!!!");。如何从文件中选择iframe元素?

1 个答案:

答案 0 :(得分:0)

这里的问题是我在本地范围内声明了iframebody。因此,当函数完全执行后,变量便消失了。 为了解决这个问题,我在函数外部声明了变量。