Archive for the ‘HTML’ Category

jQuery bind select change to anchor window.open variable

Thursday, April 29th, 2010

add window.open() to an anchor tag…

HTML:

select dropdown changes the source:

<div class=”name”>
<select name=”tpom” style=”float: left; width: 100px; margin-right:20px; border: 1px solid #5A3C18;” >
<option value=”downloader.php?file=folder/file.mp3″>Mp3</option>
<option value=”downloader.php?file=folder/file.zip”>Zip</option>
<option value=”downloader.php?file=folder/file.m4b”>Ipod</option>
</select>

link or button gets source from dropdown via jQuery onReady function:

$(“div.name select”).bind(“change”,function(){
$(‘#button_download’).attr(‘href’,this.value);
windowUrl = $(this).val();
//console.log(windowUrl);
});

<a onclick=”window.open(windowUrl,’download’);return false;” id=”button_download”>Download</a>

meta no archive tag

Wednesday, April 28th, 2010

<META content=”noarchive” NAME=”robots”>

HTML form field readonly and disable

Thursday, April 22nd, 2010

<input type=”text” readonly=”readonly” …. />

and equally useful

<input type=”text” disabled=’disabled’ …/>

Javascript HTML form field onFocus onBlur

Tuesday, April 13th, 2010

<input name=”email” id=”email” type=”text” value=”Email” onFocus=”if(this.value == ‘Email’) this.value = ”;” onBlur=”if(this.value == ”) this.value = ‘Email’;”/>

Semantic value: ul li, ol li vs. dl dt dd

Monday, March 8th, 2010
<dl>
<dt>Name: </dt>
<dd>John Don</dd>

<dt>Age: </dt>
<dd>64</dd>

<dt>Gender: </dt>
<dd>Male</dd>

<dt>Day of Birth:</dt>
<dd>12th May 1946</dd>
</dl>
VS.
Unordered lists
Use a <ul> tag where the order of items is not significant.
Ordered lists
Use an <ol> tag where the order of items is significant, e.g. listing events in time order, or race results

HTML Meta redirect 301 forward

Wednesday, March 3rd, 2010

<html>
<head>
<meta http-equiv=”refresh” content=”0;url=http://www.google.com”>
</head>
<body>
<a href=”http://www.google.com”>This page has moved</a>
</body>
</html>