Skip to content

Instantly share code, notes, and snippets.

View voku's full-sized avatar
:octocat:
There is nothing good unless you do it.

Lars Moelleken voku

:octocat:
There is nothing good unless you do it.
View GitHub Profile
@voku
voku / post_to_iframe.html
Created June 4, 2014 09:52
post data to an iframe: Doesn't take any JavaScript or anything. You just have the form's target attribute match the iframe's name attribute. The outer page doesn't even reload. But it might appear to at first glance since many browsers run the page-loading spinner in the tab when an iframe reloads. - From http://snippetlib.com/html/post_data_to…
<form action="iframe.php" target="my-iframe" method="post">
<label for="text">Some text:</label>
<input type="text" name="text" id="text">
<input type="submit" value="post">
</form>
<iframe name="my-iframe" src="iframe.php"></iframe>
@voku
voku / multiple_file_input.html
Created June 4, 2014 09:49
multiple file input: File inputs can have an attribute of "multiple" which then allows multiple files to be selected in the file section dialog box. Firefox 3.6+ and WebKit browsers only are supporting it so far. Unfortunately the "multiple files" need to be within the same folder, as there is no interface for selecting one, moving folders, and …
<form method="post" action="upload.php" enctype="multipart/form-data">
<input name='uploads[]' type="file" multiple>
<input type="submit" value="Send">
</form>
@voku
voku / meta_refresh.html
Created June 4, 2014 09:48
meta refresh: The redirects to the provided URL in 5 seconds. Set to 0 for an immediate redirect. - From http://snippetlib.com/html/meta_refresh
<meta http-equiv="refresh" content="5;url=http://example.com/" />
@voku
voku / kill_ie6.html
Created June 4, 2014 09:46
make IE6 crash: Without a fail will ALWAYS make IE6 crash. - From http://snippetlib.com/html/make_IE6_crash
<style>*{position:relative}</style><table><input></table>
@voku
voku / mailto_links.html
Created June 4, 2014 09:45
mailto links: Open default mail program, create new message with the fields already filled out. - From http://snippetlib.com/html/mailto_links - DEMO: http://jsfiddle.net/voku/e2gYs/
@voku
voku / iPhone-call.html
Created June 4, 2014 09:43
iPhone calling and texting - The calling one (probably more useful if the clickable text is words, as the iPhone auto-detects phone numbers and does this automatically) and the SMS one, which overrides the default calling behavior. Best for mobile-only sites. - From http://snippetlib.com/html/iPhone_calling_and_texting - DEMO: http://jsfiddle.ne…
<a href="tel:1-408-555-5555">1-408-555-5555</a>
<a href="sms:1-408-555-1212">New SMS Message</a>
@voku
voku / get_directions.html
Created June 4, 2014 09:41
get directions form (google maps) # saddr = blank input field for entering START address # daddr = hard-coded END address - DEMO: http://jsfiddle.net/voku/ZyU2v/
<form action="http://maps.google.com/maps" method="get" target="_blank">
<label for="saddr">Enter your location</label>
<input type="text" name="saddr" />
<input type="hidden" name="daddr" value="Düsseldorfer Straße 90, 40545 Düsseldorf" />
<input type="submit" value="get my way to work ;)" />
</form>
@voku
voku / htmlDropdownYearSelect.php
Last active August 29, 2015 14:02
form dropdown year select options: This is great for forms when needing a dropdown for year. - DEMO: http://ideone.com/QeXXP7
<?php
function htmlDropdownYearSelect() {
$yearSelectElement = '';
for ($i = date("Y"); $i >= (date("Y")-100); $i--) {
$yearSelectElement .= '<option value="' . $i . '">' . $i . '</option>';
}
return '
<select id="year" name="year">
@voku
voku / htmlDropdownMonthSelect.php
Last active August 29, 2015 14:02
form dropdown month select options: This is great for forms when needing a dropdown for month. - DEMO: http://ideone.com/AKutcm
<?php
function htmlDropdownMonthSelect() {
$monthSelectElement = '';
for ($i = 0; $i <= 12; ++$i) {
$time = strtotime(sprintf('-%d months', $i));
$value = date('Y-m', $time);
$label = strftime('%B', $time);
@voku
voku / windows-media.html
Created June 4, 2014 09:18
embedding windows media: Valid technique, as it doesn't need the "embed"-tag. - From http://snippetlib.com/html/embedding_windows_media
<object type="video/x-ms-wmv"
data="movie.wmv"
width="320" height="260">
<param name="src"
value="movie.wmv" />
<param name="autostart" value="true" />
<param name="controller" value="true" />
</object>