0

友達私のJSPには、次のコード形式があります

<%@page isELIgnored="false" trimDirectiveWhitespaces="true"
        contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="bs" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<bs:main title="Status">
        <bs:content>
                <bs:infoline />
                <div class="menubar">
                        <bs:menu />


        </bs:content>
</bs:main>
<script type="text/javascript">
$( document ).ready(function() {
        $('.save,.close').hide();
});

 $(document).ready(function () {
          var seconds = 5000; // time in milliseconds
            var reload = function() {
                  $.ajax({
                          url: 'editStatus.jsp',
                  cache: false,
                  success: function(data) {
                          $('#refreshDIV').html(data);
                  }
               });
             };
             setInterval(reload,seconds);
        });
var textValue = "";
$('.pencil').on('click', function(){
    textValue =  $(this).siblings('.textVal').text();
    $(this).siblings('.textVal').html("<input type='text' id='textVal' value='" + textValue + "' />");
    $(this).hide();
    $(this).siblings('.save, .close').show();
});

$('.save').on('click', function(){
    $(this).siblings('.textVal').html($(this).siblings('.textVal').find(':text').val());
    $(this).hide();
    $(this).siblings('.close').hide();
    $(this).siblings('.pencil').show();
});

$('.close').on('click', function(){
    $(this).siblings('.textVal').html(textValue)
    $(this).hide();
    $(this).siblings('.save').hide();
    $(this).siblings('.pencil').show();
});
</script>
<style type="text/css">
.textbox {
        height: 24px;
        width: 65px;
        line-height: 22px;
        padding: 3px
}

#textVal {
        width: 22px;
        margin-right: 4px
}

.icons {
        float: left;
        width: 20px;
        height: 20px;
}

.save,.close {
        display: none;
        width: 20px;
        height: 20px;
        float: left
}

.textVal {
        float: left;
        width: 35px;
        height: 20px;
        margin-right: 5px
}

.pencil {
        display: block
}

.red a {
        color: red
}
</style>

簡単にするために、 で始まるすべてのコードを別の css ファイルに含め、その css ファイルを上記の JSP に含めます。最善の方法を提案してくださいありがとう

4

2 に答える 2

1

タグの内容を「style.css」(または任意のファイル) という名前のファイルに移動します。このタグを JSP に追加します。

<link rel="stylesheet" type="text/css" href="style.css" />
于 2013-10-06T17:41:35.473 に答える
-1
Move the whole CSS code into a separate .css file and include  that file into your php file.

Code of Including CSS FILE:

PHP

<style>
<?php include 'CSS/main.css'; ?>
</style>


HTML
<link rel="stylesheet" href="http://www.mydomain.com/css/style.css">
于 2013-10-06T18:44:29.367 に答える