导致SharePoint中的页面刷新的HTML错误

时间:2014-10-23 21:35:52

标签: javascript html sharepoint page-refresh

我在SharePoint页面上编写了一些基本代码,并且遇到了一些我无法弄清楚的严重问题。从本质上讲,该页面将让用户填写一份简短的调查表,一旦提交,将使用嵌入式JavaScript调出一些堆叠的图像。还有一个重置按钮,用于清除所有输入的信息并隐藏图像。

当用户第一次导航到页面并完成调查时,图像将会填充,但页面将刷新,清除所有输入信息并再次隐藏图像。我输入了一个确认离开页面代码段,以便用户可以留在页面上。但是,如果用户重置页面并再次提交调查,则不再尝试离开页面。用户填写调查的次数很多,它只会在第一次尝试时尝试刷新页面。

使用随机插入的JavaScript警报,我发现在中央JavaScript函数完成后会发生此刷新(无论原因),因此错误必须在HTML中。

以前有人有这个问题吗?如果HTML存在问题,我附上以下代码:

<div id="neodegdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 88px; width: 257px; margin-left: 4px; margin-top: 117px; visibility: hidden">
</div>
<div id="neodegdiv2" style="position: absolute; z-index: 20; margin-left: 4px; margin-top: 117px;
    visibility: hidden">
    <iframe id="neodegifrm" style="visibility: hidden" height="88" width="257"></iframe>
</div>
<div id="abicurediv1" style="position: absolute; z-index: 100; background-color: black;
    height: 88px; width: 259px; margin-left: 262px; margin-top: 117px; visibility: hidden">
</div>
<div id="abicurediv2" style="position: absolute; z-index: 20; margin-left: 262px;
    margin-top: 117px; visibility: hidden">
    <iframe id="abicureifrm" style="visibility: hidden" height="88" width="259"></iframe>
</div>
<div id="ipidegbdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 88px; width: 259px; margin-left: 262px; margin-top: 206px; visibility: hidden">
</div>
<div id="ipidegbdiv2" style="position: absolute; z-index: 20; margin-left: 262px;
    margin-top: 206px; visibility: hidden">
    <iframe id="ipidegbifrm" style="visibility: hidden" height="88" width="259"></iframe>
</div>
<div id="ipidegadiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 88px; width: 256px; margin-left: 522px; margin-top: 117px; visibility: hidden">
</div>
<div id="ipidegadiv2" style="position: absolute; z-index: 20; margin-left: 522px;
    margin-top: 117px; visibility: hidden">
    <iframe id="ipidegaifrm" style="visibility: hidden" height="88" width="256"></iframe>
</div>
<div id="noncasdashboarddiv" style="position: absolute; z-index: 10; margin-left: 0px;
    visibility: hidden">
    <embed id="noncasdashboardifrm" target="_top" style="visibility: hidden" src="" height="300"
        width="800" scrolling="no" />
</div>
<div id="dashboarddiv" style="position: absolute; z-index: 0; margin-left: 0px; visibility: hidden">
    <embed id="dashboardifrm" target="_top" style="visibility: hidden" src="" height="600"
        width="800" scrolling="no" />
</div>
<div id="spartandiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 128px; margin-left: 133px; margin-top: 143px; visibility: hidden">
</div>
<div id="spartandiv2" style="position: absolute; z-index: 20; margin-left: 133px;
    margin-top: 143px; visibility: hidden">
    <iframe id="spartanifrm" style="visibility: hidden" height="69" width="128"></iframe>
</div>
<div id="steapdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 255px; margin-left: 522px; margin-top: 143px; visibility: hidden">
</div>
<div id="steapdiv2" style="position: absolute; z-index: 20; margin-left: 522px; margin-top: 143px;
    visibility: hidden">
    <iframe id="steapifrm" style="visibility: hidden" height="69" width="255"></iframe>
</div>
<div id="alliancediv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 259px; margin-left: 263px; margin-top: 143px; visibility: hidden">
</div>
<div id="alliancediv2" style="position: absolute; z-index: 20; margin-left: 263px;
    margin-top: 143px; visibility: hidden">
    <iframe id="allianceifrm" style="visibility: hidden" height="69" width="259"></iframe>
</div>
<div id="ipiabidiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 387px; margin-left: 263px; margin-top: 212px; visibility: hidden">
</div>
<div id="ipiabidiv2" style="position: absolute; z-index: 20; margin-left: 263px;
    margin-top: 212px; visibility: hidden">
    <iframe id="ipiabiifrm" style="visibility: hidden" height="69" width="387"></iframe>
</div>
<div id="arnraddiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 127px; margin-left: 650px; margin-top: 212px; visibility: hidden">
</div>
<div id="arnraddiv2" style="position: absolute; z-index: 20; margin-left: 650px;
    margin-top: 212px; visibility: hidden">
    <iframe id="arnradifrm" style="visibility: hidden" height="69" width="127"></iframe>
</div>
<div id="abicabdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 59px; width: 387px; margin-left: 263px; margin-top: 281px; visibility: hidden">
</div>
<div id="abicabdiv2" style="position: absolute; z-index: 20; margin-left: 263px;
    margin-top: 281px; visibility: hidden">
    <iframe id="abicabifrm" style="visibility: hidden" height="59" width="387"></iframe>
</div>
<div id="tcelldiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 57px; width: 514px; margin-left: 263px; margin-top: 340px; visibility: hidden">
</div>
<div id="tcelldiv2" style="position: absolute; z-index: 20; margin-left: 263px; margin-top: 340px;
    visibility: hidden">
    <iframe id="tcellifrm" style="visibility: hidden" height="57" width="514"></iframe>
</div>
<div id="enzaseizdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 259px; margin-left: 263px; margin-top: 397px; visibility: hidden">
</div>
<div id="enzaseizdiv2" style="position: absolute; z-index: 20; margin-left: 263px;
    margin-top: 397px; visibility: hidden">
    <iframe id="enzaseizifrm" style="visibility: hidden" height="69" width="259"></iframe>
</div>
<div id="mln0128div1" style="position: absolute; z-index: 100; background-color: black;
    height: 69px; width: 255px; margin-left: 522px; margin-top: 397px; visibility: hidden">
</div>
<div id="mln0128div2" style="position: absolute; z-index: 20; margin-left: 522px;
    margin-top: 397px; visibility: hidden">
    <iframe id="mln0128ifrm" style="visibility: hidden" height="69" width="255"></iframe>
</div>
<div id="mln8237div1" style="position: absolute; z-index: 100; background-color: black;
    height: 39px; width: 514px; margin-left: 263px; margin-top: 465px; visibility: hidden">
</div>
<div id="mln8237div2" style="position: absolute; z-index: 20; margin-left: 263px;
    margin-top: 465px; visibility: hidden">
    <iframe id="mln8237ifrm" style="visibility: hidden" height="39" width="514"></iframe>
</div>
<div id="bayerdiv1" style="position: absolute; z-index: 100; background-color: black;
    height: 39px; width: 514px; margin-left: 263px; margin-top: 504px; visibility: hidden">
</div>
<div id="bayerdiv2" style="position: absolute; z-index: 20; margin-left: 263px; margin-top: 504px;
    visibility: hidden">
    <iframe id="bayerifrm" style="visibility: hidden" height="39" width="514"></iframe>
</div>
<div id="il10div1" style="position: absolute; z-index: 100; background-color: black;
    height: 50px; width: 255px; margin-left: 522px; margin-top: 542px; visibility: hidden">
</div>
<div id="il10div2" style="position: absolute; z-index: 20; margin-left: 522px; margin-top: 542px;
    visibility: hidden">
    <iframe id="il10ifrm" style="visibility: hidden" height="50" width="255"></iframe>
</div>
<h3>Metastatic/Non-Metastatic</h3>
<input type="radio" id="metyes" name="Met/NoMet" />Metastatic<br />
<input type="radio" id="metno" name="Met/NoMet" />Non-Metastatic <br />
<p></p>
<hr>
<h3>Castration Resistant/Sensitive</h3>
<input type="radio" id="casyes" name="Castration" />Castration Resistant<br />
<input type="radio" id="casno" name="Castration" />Castration Sensitive<br />
<p></p>
<hr>
<h3>Prior Chemotherapy</h3>
<input type="radio" id="chemoyes" name="Chemo" />Yes<br />
<input type="radio" id="chemono" name="Chemo" />No<br />
<p></p>
<hr>
<h3>Prior Abiraterone</h3>
<input type="radio" id="abiyes" name="Abi" />Yes<br />
<input type="radio" id="abino" name="Abi" />No<br />
<p></p>
<hr>
<h3>Prior Enzalutamide</h3>
<input type="radio" id="enzayes" name="Enza" />Yes<br />
<input type="radio" id="enzano" name="Enza" />No<br />
<p></p>
<hr>
<h3>Previous Protocols</h3>
<input type="checkbox" id="neodeg" style="align: left" name="prevprotocol">11-182
Neo-Degarelix<br />
<input type="checkbox" id="abicure" style="align: left" name="prevprotocol">12-187
AbiCure<br />
<input type="checkbox" id="ipidega" style="align: left" name="prevprotocol">13-134
Ipi-Degarelix (Cohort A)<br />
<input type="checkbox" id="ipidegb" style="align: left" name="prevprotocol">13-134
Ipi-Degarelix (Cohort B)<br />
<input type="checkbox" id="spartan" style="align: left" name="prevprotocol">13-243
SPARTAN<br />
<input type="checkbox" id="alliance" style="align: left" name="prevprotocol">13-247
Alliance<br />
<input type="checkbox" id="ipiabi" style="align: right" name="prevprotocol">12-120
Ipi + Abi<br />
<input type="checkbox" id="abicabazi" style="align: left" name="prevprotocol">14-046
Abi +/- Cabazi<br />
<input type="checkbox" id="enzaseizure" style="align: right" name="prevprotocol">13-231
Enza Seizure<br />
<input type="checkbox" id="mln0128" style="align: left" name="prevprotocol">13-143
MLN0128<br />
<input type="checkbox" id="tcell" style="align: right" name="prevprotocol">09-036
T-Cell<br />
<input type="checkbox" id="arnrad" style="align: left" name="prevprotocol">13-025
ARN-RAD 001<br />
<input type="checkbox" id="steap" style="align: right" name="prevprotocol">11-016
STEAP<br />
<p></p>
<hr>
<input type="submit" onclick="pullAnswers2()" style="background-color: green">
<input type="RESET" onclick="return clearAll()" style="background-color: red">
<!--<INPUT type=reset onClick="hideDashboard()" style="background-color:yellow" value="Hide">-->

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

您的提交按钮是问题所在。当用户单击按钮时,您可以调用javascript函数pullAnswers2(),但它不会阻止按钮完成提交过程。最简单的解决方法是

<input type="submit" onclick="pullAnswers2();return false" style="background-color: green">