好了,我有一种形式,它允许用户做出事件的预订如下:为什么我的javascript window.opener.location.reload重新加载不同的URL?
<h3>Booking Form</h3>
<p><form method="post" action="/heroes-and-heroines-larp-and-lrp-events.php?task=submitBooking" class="bookingForm">
<label for="role">Booking:</label>
<select name="role" id="role">
<option value="Player">Play</option>
<option value="Monster">Monster</option>
<option value="MIA">Unable to Attend</option>
<option value="Referee">Referee</option>
</select><br />
<div id="AttendeeName"><label for="bookingName">Attendee Name:</label><select name="bookingName" id="listedBookingName">
<option value="1">3rd spearman</option>
<option value="2">4th spearman</option>
</select></div>
<div id="CharacterName"><label for="characterName">Character Name:</label><select name="CharacterName" id="listedCharacterName">
<option value="1">Jack Dawkins</option>
<option value="2">Reverand Blighty Shrewson</option>
<option value="3">Sydion</option>
**</select><button class="button" onClick="window.open('http://www.heroesandheroines.org/index.php?task=siteForm', '', 'width=500, height=500');"><span class="formButton">create a new character</span>**</button></div>
<div id="telephoneNumber"><label for="telephone">Telephone Number:</label>
<input required type="tel" id="telephone" name="telephone" value="" /></div>
<div id="emailAddress"><label for="email">E-mail Address:</label>
<input required type="email" id="email" name="email" value="[email protected]" /></div>
<div id="notes"><label for="notes">Notes:</label>
<textarea id="notes" name="notes" rows="4" cols="50" placeholder="notes" /></textarea>
</div><input type="hidden" name="returnPage" value="http://heroesandheroines.org/heroes-and-heroines-larp-and-lrp-events/124_tbc.html" />
<input type="hidden" name="dungeonid" value="124" />
<input type="submit" name="submit Booking" value="Submit Booking" />
<a href="">CANCEL</a></p>
</form>
按钮<button class="button" onClick="window.open('http://www.heroesandheroines.org/index.php?task=siteForm', '', 'width=500, height=500');">
火灾打开一个新的窗口,它允许用户创造出一个新的字符在事件上使用。
新窗口中有如下因素的javascript:
<script>
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload()
}
</script>
现在,它的工作正在进行中,但我要的是子窗口刷新父窗口,然而,子窗口不刷新父窗口的原始内容(http://heroesandheroines.org/heroes-and-heroines-larp-and-lrp-events.php?task=bookingForm&eventID=124)...它加载http://heroesandheroines.org/heroes-and-heroines-larp-and-lrp-events.php?task=submitBooking这是窗体的目标...如何获取父窗口刷新其URL而不是表单提交URL?
另外,我很困惑,为什么它的行为是这样的...肯定window.opener.location.reload应该只是刷新页面从请求的URI或什么?
'行动=“/英雄,和女主角 - 叻和-LRP事件.php?task = submitBooking“'您的'表单'正在提交,因此'URL'正在更改。 – melancia 2015-02-09 17:31:18