can a select box, open another window or modal box?
I have code like so:
<div class="field4"><label for="go" >Info <a href="helper/info.html?lightbox[width]=560&lightbox[height]=600" class="lightbox"><span class="helper open">?</span></a></label>
<select id="go" name="go">
<option value="">Please select an option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
If they select YES , I would like to invoke a href to specific address,perhaps a modal box Is this dooable ?
Have checked around and not seen how to do it.
Ok the update is:
<div class="field4">
<img src="images/bugme.png" class="bugmeFloat"><label for="sms" >SMS Alerts <a href="helper/sms.html?lightbox[width]=560&lightbox[height]=600" class="lightbox"><span class="helper open">?</span></a></la开发者_运维百科bel>
<select id="sms" name="sms">
<option value="">Please select an option</option>
<option value="no">No thanks</option>
<option value="yes">Purchase SMS Messaging</option>
</select>
</div>
<!--inline script for modal open off select choice-->
<script type="text/javascript" language="javascript">
$(function() {
$('#sms').change(function() {
if ($(this).val() == 'yes') {
window.location = 'helper/sms.html?lightbox[width]=560&lightbox[height]=600';
}
});
});
</script>
<!--//end inline modal box open -->
It isnt opening window or modal..... hmm
Yes. You would have something like this:
$(function() {
$('#go').change(function() {
if ($(this).val() == 'yes') {
window.location = 'www.mynewaddress.com';
}
});
});
Essentially, you are navigating to a new address when they change the select's value, if a certain condition is met.
Relevant documentation:
- jQuery's
.change()
event - http://api.jquery.com/change/ - JavaScript redirect - http://www.tizag.com/javascriptT/javascriptredirect.php
精彩评论