我要求在用户尝试关闭浏览器窗口时获取访问权限。我得到了这个方法 -
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<center>
<h1>Vacation Rental</h1>
</center>
<div>
<form id="chatham">
<label><b><u>Chatham, MA</u></b></label><br>
<label><b>$300 a Day</b></label><br>
<label>Name:</label><br>
<input name="nameA" type="text" /><br>
<label>Email Address:</label><br>
<input name="emailA" type="text" /><br>
<label>Phone Number:</label><br>
<input name="phoneA" type="text" /><br>
<label>How many days would you like to rent?</label><br>
<select>
<option value="5-10">5-10 Days</option>
<option value="6-7">10-15 Days</option>
<option value="8-9">15-20 Days</option>
</select>
<input id="showA" type="button" value="Show Picture">
<input id="submitA" type="button" value="Submit">
<input id="resetA" type="button" value="Reset">
</form>
</div>
<div>
<form id="wellfleet">
<label><b><u>Wellfleet, MA</u></b></label><br>
<label><b>$250 a Day</b></label><br>
<label>Name:</label><br>
<input name="nameB" type="text" /><br>
<label>Email Address:</label><br>
<input name="emailB" type="text" /><br>
<label>Phone Number:</label><br>
<input name="phoneB" type="text" /><br>
<label>How many days would you like to rent?</label><br>
<select>
<option value="5-10">5-10 Days</option>
<option value="6-7">10-15 Days</option>
<option value="8-9">15-20 Days</option>
</select>
<input id="showB" type="button" value="Show Picture">
<input id="submitB" type="button" value="Submit">
<input id="resetB" type="button" value="Reset">
</form>
</div>
<div>
<form id="dennis">
<label><b><u>Dennis, MA</u></b></label><br>
<label><b>$350 a Day</b></label><br>
<label>Name:</label><br>
<input name="nameC" type="text" /><br>
<label>Email Address:</label><br>
<input name="emailC" type="text" /><br>
<label>Phone Number:</label><br>
<input name="phoneC" type="text" /><br>
<label>How many days would you like to rent?</label><br>
<select>
<option value="5-10">5-10 Days</option>
<option value="6-7">10-15 Days</option>
<option value="8-9">15-20 Days</option>
</select>
<input id="showC" type="button" value="Show Picture">
<input id="submitC" type="button" value="Submit">
<input id="resetC" type="button" value="Reset">
</form>
</div>
<div>
<form id="provincetown">
<label><b><u>Provincetown, MA</u></b></label><br>
<label><b>$300 a Day</b></label><br>
<label>Name:</label><br>
<input name="nameD" type="text" /><br>
<label>Email Address:</label><br>
<input name="emailD" type="text" /><br>
<label>Phone Number:</label><br>
<input name="phoneD" type="text" /><br>
<label>How many days would you like to rent?</label><br>
<select>
<option value="5-10">5-10 Days</option>
<option value="6-7">10-15 Days</option>
<option value="8-9">15-20 Days</option>
</select>
<input id="showD" type="button" value="Show Picture">
<input id="submitD" type="button" value="Submit">
<input id="resetD" type="button" value="Reset">
</form>
</div>
<img id="house1" src="http://placehold.it/350x150" />
<img id="house2" src="http://placehold.it/350x150" />
<img id="house3" src="http://placehold.it/350x150" />
<img id="house4" src="http://placehold.it/350x150" />
或
l = ['a', 'b', 'c', 'a', 'd']
for i in range(len(l)-2, -1, -1):
if l[i] == 'a':
l[i] = l[i] + l.pop(i+1)
print(l)
虽然这些工作甚至可以在页面导航后退和页面重新加载。任何人都可以帮助如何控制页面关闭?
我传递的消息也没有显示相同,在firefox上显示 -
此页面要求您确认是否要离开 - 为您提供数据 已输入可能无法保存。
在chrome上说 -
要重新加载此网站吗?你所做的改变可能不是 保存。