запрет на изменение стандартного текста в input

Ответить
Аватара пользователя
Assasin
Сообщения: 105
Зарегистрирован: 17.02.2011
типа readonly только что бы например если в text input есть текст его нельзя было менять но можно было к нему дописывать)
подскажите плиз уже 2 гуглю ничего найти не могу

-- добавлено 07 окт 2011, 23:03 --

короче value только что бы изменить нельзя было
< ̄`ヽ、       /  ̄ >
 ゝ、  \ /⌒ヽ,ノ   /´
   ゝ、 ( ( ͡◉ ͜> ͡◉) /
     >     ,ノ
  ℧   ∠_,,,/´
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Аватара пользователя
AgentSIB
Сообщения: 329
Зарегистрирован: 17.05.2010
Можно например так.

Код: Выделить всё

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title></title>
    <style type="text/css">
        .st_input{
            position: relative;
        }
        .st_input *{
            font-family: Arial;
            font-size: 15px;
        }
        .st_input .word{
            position: absolute;
            padding-left: 3px;
            padding-top: 3px;
            height: 18px;
        }
        .st_input .input1{
            border: 1px solid black;
            width: 200px;
            height: 18px;
            padding-left: 35px;
        }
    </style>
</head>
<body>
    <div class="st_input">
        <div class="word">Тест</div>
        <input type="text" class="input1" />
    </div>
    
</body>
</html>
Frustra fit per plura quod potest fieri per pauciora © Закон "Бритвы Оккама"

Аватара пользователя
AgentSIB
Сообщения: 329
Зарегистрирован: 17.05.2010
Или например так:

Код: Выделить всё

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title></title>
    <style type="text/css">
        .st_input{
            position: relative;
        }
        .st_input *{
            font-family: Arial;
            font-size: 15px;
        }
        .st_input .word{
            border: 1px solid black;
            border-right: none;
            float: left;
            height: 18px;
            padding: 2px 5px 0px 2px;
        }
        .st_input .input1{
            border: 1px solid black;
            border-left: none;
            float: left;
            width: 200px;
            height: 18px;
        }
    </style>
</head>
<body>
    <div class="st_input">
        <div class="word">Тест</div>
        <input type="text" class="input1" />
    </div>
    
</body>
</html>
Так же можно воспользоваться средствами яваскрипта. Но эти варианты будут работать в любом случае.
Frustra fit per plura quod potest fieri per pauciora © Закон "Бритвы Оккама"

Аватара пользователя
Assasin
Сообщения: 105
Зарегистрирован: 17.02.2011
Спасибо огромное
< ̄`ヽ、       /  ̄ >
 ゝ、  \ /⌒ヽ,ノ   /´
   ゝ、 ( ( ͡◉ ͜> ͡◉) /
     >     ,ノ
  ℧   ∠_,,,/´
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Ответить