You purpose and the purpose of the
onclick
handler (
convertFunction
) remain unclear to me; all looks weird. But one problem is apparent: you complain about passing data to a function, but instead pass some string constant, "Con1". What would you expect then?
Whatever you want to do, you need to pass some variable related to the text input control. Most general way is to pass its reference, "this". Please see how this sample works:
<html>
<head>
<script>
function onTextClick(data) {
alert(data.value);
}
</script>
</head>
<body>
<input type="text" value="some text value" onclick="onTextClick(this)">
</body>
</html>
In this sample
alert
call will show the text entered in the input element using this handler. In your "real" handler, you can do with this data whatever you want. Even if this is something weird. :-)
—SA