简体   繁体   English

如何将脚本放入脚本中

[英]How to put script inside of script

I'm trying to figure out how I can make my form popup when someone hits yes. 我试图弄清楚当有人单击“是”时如何使表格弹出。 How do I incorporate this...? 我该如何合并...?

Here's the JSFiddle: http://jsfiddle.net/VqqWW/ 这是JSFiddle: http//jsfiddle.net/VqqWW/

Here's the form: 形式如下:

<script type="text/javascript" src="http://form.jotform.us/jsform/32217646901149"></script>

I've tried putting, 我试过了

if (q1 == "Yes") {
      document.getElementById("linkDiv").innerHTML = "<script type="text/javascript" src="http://form.jotform.us/jsform/32217646901149" />";
    }

That doesn't seem to work and I've also tried putting the code somewhere else in the head and linking it to that script but I'm not sure what's wrong. 这似乎不起作用,我还尝试将代码放在其他地方,并将其链接到该脚本,但是我不确定出什么问题。

function loadForm(){
    var fileref = document.createElement('script')
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", "http://form.jotform.us/jsform/32217646901149")
}

Stole this from this site . 这个网站上偷了这个。

I'm not sure what you have done in that jotform script. 我不确定您在该jotform脚本中做了什么。 However instead of creating new script files, generate the form(jotform) dynamically and add it in the innerHTML or make a reference variable to script and call it here. 但是, 与其创建新的脚本文件, 不如动态地生成form(jotform)并将其添加到innerHTML或者创建一个引用变量以编写脚本并在此处调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM