innerHTML

D

DIANIKA

Hy everyone,
i'm tryin' to get a dinamic effect using html/javascript: I need to show a
sentence at the top of a table according to a value in an input text. And I
need the page doesn't get reloaded.
I remember something about an innerHTML tag, does anyone has an example?
tnks in advance
D.
 
W

WindAndWaves

DIANIKA said:
Hy everyone,
i'm tryin' to get a dinamic effect using html/javascript: I need to show a
sentence at the top of a table according to a value in an input text. And I
need the page doesn't get reloaded.
I remember something about an innerHTML tag, does anyone has an example?
tnks in advance
D.

I recently did something like that www.corstorphinehouse.com/d/avail.html :

function showRow(d,m,y,len) {
if (document.getElementById) {
var z = document.getElementById('D'+y+m+d)
// If an in-range date is entered
if (z){
hideRows();
z.style.display = ''
var j = z.rowIndex;
// Show as many rows as the length of stay
for (var i=0; i<len-1; i++) {
// As long as there are rows to show, show them
if (z.parentNode.rows[j+i]) {
z.parentNode.rows[j+i].style.display='';
// If the length of stay goes past the end of the table, stop trying to show
more rows
} else {
document.getElementById('err').innerHTML = 'You have gone past the end
of the searcheable period - please contact us directly or try a different
date.'
return;
}
}
// otherwise the date is out of range
} else {
document.getElementById('err').innerHTML = 'You have entered dates that
fall outside the searchable period - please contact us directly or try again
with a different date.';
hideRows('all');
}
}
}


function hideRows(a){
if (document.getElementById) {
if (a == 'all') {
var t = document.getElementById('roomAvail').rows;
for (var i=0; i<t.length; i++) {
if (t.id != 'D000000' && t.id != '') {
t.style.display = 'none';
} else {
t.style.display = 'block';
}
}
} else {
var t = document.getElementById('roomAvail').rows;
for (var i=0; i<t.length; i++) {
if (t.id != '') {
t.style.display = 'none';
}
}
}
}
}
 
D

DIANIKA

exactly what i need
thank tou
WindAndWaves said:
DIANIKA said:
Hy everyone,
i'm tryin' to get a dinamic effect using html/javascript: I need to show a
sentence at the top of a table according to a value in an input text.
And
I
need the page doesn't get reloaded.
I remember something about an innerHTML tag, does anyone has an example?
tnks in advance
D.

I recently did something like that www.corstorphinehouse.com/d/avail.html :

function showRow(d,m,y,len) {
if (document.getElementById) {
var z = document.getElementById('D'+y+m+d)
// If an in-range date is entered
if (z){
hideRows();
z.style.display = ''
var j = z.rowIndex;
// Show as many rows as the length of stay
for (var i=0; i<len-1; i++) {
// As long as there are rows to show, show them
if (z.parentNode.rows[j+i]) {
z.parentNode.rows[j+i].style.display='';
// If the length of stay goes past the end of the table, stop trying to show
more rows
} else {
document.getElementById('err').innerHTML = 'You have gone past the end
of the searcheable period - please contact us directly or try a different
date.'
return;
}
}
// otherwise the date is out of range
} else {
document.getElementById('err').innerHTML = 'You have entered dates that
fall outside the searchable period - please contact us directly or try again
with a different date.';
hideRows('all');
}
}
}


function hideRows(a){
if (document.getElementById) {
if (a == 'all') {
var t = document.getElementById('roomAvail').rows;
for (var i=0; i<t.length; i++) {
if (t.id != 'D000000' && t.id != '') {
t.style.display = 'none';
} else {
t.style.display = 'block';
}
}
} else {
var t = document.getElementById('roomAvail').rows;
for (var i=0; i<t.length; i++) {
if (t.id != '') {
t.style.display = 'none';
}
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top