Initial commit
This commit is contained in:
54
functions.js
Executable file
54
functions.js
Executable file
@@ -0,0 +1,54 @@
|
||||
function emptyBox(element, text)
|
||||
{
|
||||
//var textarea = $('#thoughts_form textarea[name="thoughts"]');
|
||||
if(element.value == text)
|
||||
{
|
||||
element.value = '';
|
||||
}
|
||||
else if(element.value == '')
|
||||
{
|
||||
element.value = text;
|
||||
}
|
||||
}
|
||||
|
||||
function setHeight(element)
|
||||
{
|
||||
var padtext = element.value;
|
||||
var height = Math.max(300, 130 + Math.round((padtext.length / 85 + padtext.split("\n").length) * 20));
|
||||
//alert(height);
|
||||
element.style.height = height+'px';
|
||||
}
|
||||
|
||||
function goTo(url)
|
||||
{
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
function addInput(form, name, type, value)
|
||||
{
|
||||
var registerInput = document.createElement('input');
|
||||
registerInput.setAttribute('type', type);
|
||||
registerInput.setAttribute('name', name);
|
||||
registerInput.setAttribute('value', value);
|
||||
document.forms[form].appendChild(registerInput);
|
||||
}
|
||||
|
||||
/*
|
||||
texts = new Object();
|
||||
texts['thoughts'] = 'Talk to me.';
|
||||
texts['login'] = 'Nickname';
|
||||
texts['pass'] = 'Password';
|
||||
|
||||
window.onload = function ()
|
||||
{
|
||||
for (i in texts)
|
||||
{
|
||||
var id = document.getElementById(i);
|
||||
if(id)
|
||||
{
|
||||
id.addEventListener('focus', function() {emptyBox(this, texts[this.name]);}, false);
|
||||
id.addEventListener('blur', function() {emptyBox(this, texts[this.name]);}, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
Reference in New Issue
Block a user