isi comboBox sama dengan textfield

sbnrnya bingung mau kasih judul apa….
yg penting kalian yg butuh ini tau lah….
Script ini berfungsi untuk menyamakan isi combobox dg textfield ato valuenya combobox=textfiled.
Klo msh bingung ntar tanya aja akoe…. aj. OK!

<html>
<head>
<title>test</title>

<script language=“JavaScript”>

function PrintValues(){

var myString = document.mainform.file.value
var myStringLength = myString.length
var Comma = myString.lastIndexOf(‘,’)
var SufNumChars = Comma + 1

document.mainform.result.value=(”);

for(i=0; i<Comma; i++)
document.mainform.result.value+=(myString.charAt(i));

document.mainform.result.value+=(‘ ‘);

for(i=SufNumChars; i<myStringLength; i++)
document.mainform.result.value+=(myString.charAt(i));

}

</script>

</head>
<body>

<form name=“mainform”>

<p>
<select name=“file” size=“1” onchange=“PrintValues();” target=“_parent._top”
onmouseclick=“this.focus()”>
<option value=“Joe,Yin”>First Option</option>

<option value=“Hi,Me”>Second Option</option>
</select>

<input name=“result”>

</form>

</body>
</html>

klo mo coba script diatas klik disini

he…he… bisa khan???
^^ script ini aku ambil dr www.java2s.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s