Created
June 25, 2014 03:01
-
-
Save lyonsun/2f7f9de58f5ac975e22e to your computer and use it in GitHub Desktop.
dummy js script to create a select dropdown list in a new window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#preview').bind('click', function(e) { | |
var minimum = parseInt($('#minimum').val()); | |
var maximum = parseInt($('#maximum').val()); | |
var interval = parseInt($('#interval').val()); | |
var times = Math.floor(maximum/interval); | |
var html = ''; | |
for (var i = 0; i < times; i++) { | |
html += "<option value='" + minimum.toFixed(2) + "'>" + minimum.toFixed(2) + "</option>"; | |
minimum += interval; | |
if (minimum > maximum) { | |
break; | |
}; | |
}; | |
var w = window.open(); | |
var html = "<select>" + html + "</select>"; | |
$(w.document.body).html(html); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment