【问题标题】:Infusionsoft Javascript - Necessary?Infusionsoft Javascript - 有必要吗?
【发布时间】:2013-10-11 02:50:32
【问题描述】:

我正在将 Infusionsoft 网络表单插入我为客户构建的网站中。他想要使用一个可以的 Infusionsoft 网络表单。但是表单的onsubmit 有很多我不明白的代码。它的目的是什么?

代码如下:

onsubmit="var form = document.forms[0];
var resolution = document.createElement('input');
resolution.setAttribute('id', 'screenResolution');
resolution.setAttribute('type', 'hidden');
resolution.setAttribute('name', 'screenResolution');
var resolutionString = screen.width + 'x' + screen.height;
resolution.setAttribute('value', resolutionString);
form.appendChild(resolution);
var pluginString = '';
if (window.ActiveXObject) {
var activeXNames = {'AcroPDF.PDF':'Adobe Reader',
    'ShockwaveFlash.ShockwaveFlash':'Flash',
    'QuickTime.QuickTime':'Quick Time',
    'SWCtl':'Shockwave',
    'WMPLayer.OCX':'Windows Media Player',
    'AgControl.AgControl':'Silverlight'};
var plugin = null;
for (var activeKey in activeXNames) {
    try {
        plugin = null;
        plugin = new ActiveXObject(activeKey);
    } catch (e) {
        // do nothing, the plugin is not installed
    }
    pluginString += activeXNames[activeKey] + ',';
}
var realPlayerNames = ['rmockx.RealPlayer G2 Control',
    'rmocx.RealPlayer G2 Control.1',
    'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
    'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',
    'RealPlayer'];
for (var index = 0; index < realPlayerNames.length; index++) {
    try {
        plugin = new ActiveXObject(realPlayerNames[index]);
    } catch (e) {
        continue;
    }
    if (plugin) {
        break;
    }
}
if (plugin) {
    pluginString += 'RealPlayer,';
}
} else {
for (var i = 0; i < navigator.plugins.length; i++) {
    pluginString += navigator.plugins[i].name + ',';
}
}
pluginString = pluginString.substring(0, pluginString.lastIndexOf(','));
var plugins = document.createElement('input');
plugins.setAttribute('id', 'pluginList');
plugins.setAttribute('type', 'hidden');
plugins.setAttribute('name', 'pluginList');
plugins.setAttribute('value', pluginString);
form.appendChild(plugins);
var java = navigator.javaEnabled();
var javaEnabled = document.createElement('input');
javaEnabled.setAttribute('id', 'javaEnabled');
javaEnabled.setAttribute('type', 'hidden');
javaEnabled.setAttribute('name', 'javaEnabled');
javaEnabled.setAttribute('value', java);
form.appendChild(javaEnabled);"

我想在保持表单正常工作的同时删除所有不必要的代码。

必要的代码有什么作用?我以前没有使用过 Infusionsoft Forms。

【问题讨论】:

  • 从标题和问题来看,感觉标签有错别字,已重新标记为JavaScript。如果不是错字,请随时回滚。
  • 似乎您正在使用 infusionsoft 表单的 HTML 样式代码。一定要使用 UNSTYLED 代码,然后你会减少代码,你也很高兴。

标签: javascript forms onsubmit infusionsoft


【解决方案1】:

infusionsoft 表单无需任何代码即可实际工作和提交。看起来编写该代码的人正在做许多与 infusionsoft 无关的其他事情。

您可以从技术上删除所有这些,只要表单可以正常工作。这是一个示例表单,您可以查看 infusionsoft 网络表单的外观:

<form accept-charset="UTF-8" action="https://appname.infusionsoft.com/app/form/process/2f7236cb361ea9a84669eb9446ed7d6b" class="infusion-form" method="POST">
    <input name="inf_form_xid" type="hidden" value="2f7236cb361ea9a84669eb9446ed7d6b" />
    <input name="inf_form_name" type="hidden" value="Name of Form" />
    <input name="infusionsoft_version" type="hidden" value="1.29.6.32" />
    <div class="infusion-field">
        <label for="inf_field_FirstName">First Name *</label>
        <input class="infusion-field-input-container" id="inf_field_FirstName" name="inf_field_FirstName" type="text" />
    </div>
    <div class="infusion-field">
        <label for="inf_field_LastName">Last Name *</label>
        <input class="infusion-field-input-container" id="inf_field_LastName" name="inf_field_LastName" type="text" />
    </div>
    <div class="infusion-field">
        <label for="inf_field_Email">Email *</label>
        <input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="text" />
    </div>
    <div class="infusion-field">
        <span class="infusion-option">
            <input id="inf_option_Signmeupforthenewsletter" name="inf_option_Signmeupforthenewsletter" type="checkbox" value="455" />
            <label for="inf_option_Signmeupforthenewsletter">Sign me up for the newsletter</label>
        </span>
    </div>
    <div class="infusion-submit">
        <input type="submit" value="Submit" />
    </div>
</form>

我不建议您删除其他代码。它只是与 infusionsoft 表单本身及其提交能力无关。

【讨论】:

  • 页面上的所有代码都是我的,除了网络表单。我将尝试使用和不使用代码的表单。会看看会发生什么。感谢您的帮助并发布示例表单!
【解决方案2】:

不,我看不到任何可以缩短它的东西,它正在为登录fourm运行一个java程序

【讨论】:

  • 但是什么登录表单?这是一个人向我的客户提交查询。有必要吗?
  • 它看起来并不那么重要...只是检测屏幕大小、安装的插件和各种启用。但谁知道呢。如果 RealPlayer 未安装在用户的浏览器或其他东西中,他们可能有删除该站点的代码。我们必须查看他们的代码才能确定。
猜你喜欢
  • 2016-10-03
  • 2012-12-14
  • 2011-10-21
  • 2021-11-11
  • 2016-04-24
  • 2011-06-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多