开发者

I have one Textbox and inside the textbox i want the text which user cannot be deleted

i have one text box in which the text i开发者_高级运维nside the text box should not be deleted and after the text only the cursor has to be placed

Ex: For the textbox: "http://" should be available and the text which is in quotations cannot be deleted inside the textbox and the cursor should be after the quotations.

Thanks in advance, Vara Prasad.M


add this to the input field:

onchange="testEdit(this)"

and have a javascript function that does something like this:

function testEdit(field) {
  if (field.value.substring(0, 8) != "http://") {
    field.value = "http://" + field.value.substring(8);
  }
}

However, this is sloppy. The best way is to put the http:// in a label OUTSIDE the text box. If something is in a text box, it should be input. By putting that inside the text box, you will be confusing your users.

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜