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 回答