1

我正在将 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。

4

2 回答 2

2

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 表单本身及其提交能力无关。

于 2013-10-11T04:51:16.470 回答
0

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

于 2013-10-11T02:56:59.897 回答