Le 11/20/08 12:44 AM, Linda a écrit :
I have 2 labels on a page...(weight, age). The user will click on the
label to set the focus on a label. There will be 10 buttons (0-9) on
the page. I want to update the label as the user clicks on the
buttons. Then the user should be able to move to the second label and
enter the numbers by using the buttons. I don't want this to be a
textarea or text but rather a label. How do I do this?
What can be a label for you ?
To create and display a virtual numeric keyboard is not too much difficult.
I don't know the iPhone, and I don't use internet on my mobile, but it
seems to me that my children use their phones to send SMS ? I think they
have a kind of autosuggestion when writing but not a popup keyboard.
If the question is how to abort the iPhone's keyboard popup, I don't know.
If the question is how to set a tag reacting to a click, here it is :
<tag onclick="numKeyBd(this);">age: <span></span></tag>
function numKeyBd(what) {
var k = document.getElementById('numKeyBoard');
k.label = what.getElementsByTagName('span')[0];
what.parentNode.appendChild(k);
k.style.display = 'block';
}
Then you create a DIV idded 'numKeyBoard' with your 12 buttons
(don't forget the backspace)
<button value="9" onclick="return entree(this);">9</button>
....
<br>
<button value="0" onclick="return entree(this);">0</button>
<button value="." onclick="return entree(this);">.</button>
<button onclick="return delLastEnter();"><</button>
<br>
<a href="javascript
:closeKB();">close</a>
</div>
function entree(quoi) {
var c = document.getElementById('numKeyBoard').label;
c.innerHTML += quoi.value;
return false;
}
function closeKB() {
document.getElementById('numKeyBoard').style.displ ay = 'none';
}
--
sm