2011-06-30 14 views
0

URLを取得するJSPアプリケーションに要件がありますエンドユーザからの入力として。このURLは、エンドユーザーが入力できる固定値(エンドユーザーが変更できない可能性のあるデータベースのURL値のリスト)と接尾辞(URLの場合)で構成されています。固定値(ドロップダウンボックスから)+サフィックス(ユーザーが入力する値)を結合し、この値を同じページのフォームのテキストボックスに入力します。

この固定+接尾辞の値を同じWebページのフォームのテキストボックスに入力します。 どうすればいいですか?また、最終値が入力されたテキストボックスが編集可能でないことを確認したい。

上記はHTMLフォームを使用して行うことができますか?あなたがコードサンプルを提供できるなら、私はそれを感謝します。

+0

任意の方法を、これと関連し、このです:http://stackoverflow.com/questions/6534149/get-text-data-from-end-user-with-one-field-having -uneditable-list-of-drop-down-v? –

+0

oops thats my mistake ...私は同じクエリを2回投稿しました:( – Arvind

答えて

1
<html> 
    <head> 
     <script> 
    function populateTxtFiled(){ 
     var url = document.getElementById('url'); 
     alert(url.value) 
     document.getElementById('websiteUrl').value = "htttp://www."+url.value; 
     document.getElementById('websiteUrl').disabled =true; 

      } 

    </script> 
    </head> 


<body> 
Select Website: 
<select id="url" onchange="populateTxtFiled()"> 
    <option value="0">select website url</option> 
    <option value="google.com">google</option> 
    <option value="yahoo.com">yahoo</option> 
    <option value="youtube.com">youtube</option> 
    </select> 
<br /> 
<br /> 
Website Url<input id="websiteUrl" type="text" name="websitUrl"/> 

関連する問題