我无法弄清楚如何将变量(p1,p2,p3)传递到' data-url'此html对象的属性,嵌入的typeform。我在使用" a.url-data"时收到无效左手分配错误并且在使用a.setAttribute时获得了一个未定义的函数(" url-data"," http .....)
<script type="text/javascript">// <![CDATA[
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
console.log('The value of ' + name + ' is: ' + results[2].replace(/\+/g, " "));
return decodeURIComponent(results[2].replace(/\+/g, "%20"));
}
var p1 = getParameterByName('p1')
var p2 = getParameterByName('p2')
var p3 = getParameterByName('p3')
p1 = p1.replace(/ /g, "%20");
p2 = p2.replace(/ /g, "%20");
p3 = p3.replace(/ /g, "%20");
// ]]></script><!-- Change the width and height values to suit you best -->
<div class="typeform-widget" data-url="https://eatforklore.typeform.com/to/XPDPsx?p1=xxxxx&p2=xxxxx&p3=xxxxx&p4=xxxxx" data-text="Mo. 1 Product Reviews" style="width: 100%; height: 500px;"></div>
<script>// <![CDATA[
var a = document.getElementsByTagName('typeform-widget');
a.data-url = "https://eatforklore.typeform.com/to/XPDPsx?p1=" + p1;
(function(){var qs,js,q,s,d=document,gi=d.getElementById,ce=d.createElement,gt=d.getElementsByTagName,id='typef_orm',b='https://s3-eu-west-1.amazonaws.com/share.typeform.com/';if(!gi.call(d,id)){js=ce.call(d,'script');js.id=id;js.src=b+'widget.js';q=gt.call(d,'script')[0];q.parentNode.insertBefore(js,q)}})()
// ]]></script>
答案 0 :(得分:0)
问题是,脚本在具有类名的for (int i =start; i<=end, i++){
if(i % 2 = 0){
System.out.print(i + " ");
}
}
之前运行。你需要这样做:
div