체크박스클릭시 내용삽입

WEB/자바 2008. 3. 2. 00:11
<html>
<head>
    <title>http://www.blueb.co.kr</title>
</head>
<script>
<!--

function writeBox(checkvalue){
    var theform = document.form1;
    var quote = theform.box.value
    var quote1 = theform.input[checkvalue].value;
    var quechk = theform.input[checkvalue].checked;

    if(quechk == true){
        theform.box.value = quote + ' ' + quote1
    } else{
        theform.box.value = quote.replace(quote1,"");
    }
}
// -->
</script>

</head>

<form name="form1">
<CENTER>
    <input type=text value="" name="box" size="75"><BR>
    <input type=checkbox  onClick="writeBox('0')" name='input' value='HTML'> HTML
    <input type=checkbox  onClick="writeBox('1')" name='input' value='JAVASCRIPT'> JAVASCRIPT
    <input type=checkbox  onClick="writeBox('2')" name='input' value='CSS'> CSS
    <input type=checkbox  onClick="writeBox('3')" name='input' value='WEBDESIGN'> WEBDESIGN
    <input type=checkbox  onClick="writeBox('4')" name='input' value='PHOTOSHOP'> PHOTOSHOP
<BR>
<input type=reset value="Clear!">
</form>

출처: 블루비
: