脚本标记内容正在页面中打印

时间:2012-03-15 05:55:41

标签: javascript jquery ruby-on-rails jqgrid

我是Rails的新手。我在项目中使用jQuery和jQGrid。我遇到的问题是当我加载页面时,页面中显示以下内容。我不知道是什么原因。任何人都可以告诉我这个问题的原因。

<script src="/javascripts/jqgrid/jquery.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/jquery-ui-1.7.1.custom.min.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/jquery.layout.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/i18n/grid.locale-en.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/jquery.jqGrid.min.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/jquery.tablednd.js?1331713080" type="text/javascript"></script>
<script src="/javascripts/jqgrid/jquery.contextmenu.js?1331713080" type="text/javascript"></script>

这是我的观看代码,

<%= stylesheet_link_tag "process_mon/style" %>
<%= javascript_include_tag "process_mon/conf" %>
<%= javascript_include_tag "prototype" %>
<%= javascript_include_tag "process_mon/monitor" %>
<%= javascript_include_tag "process_mon/validations"%>
<style>
        fieldset{
                font-family: Times New Roman;
                font-size: 12;
        }
        body {
                background : #f9f9f3;
        }        
.tabmenu a, #tabmenu a.active {
        background: none repeat scroll 0 0 #E6B662;
        color: #000000;
        font-size: 12px;
        font-weight: bold;
        margin: 0;
        padding: 3px 8px 1px;
        text-decoration: none;
}    
.tabmenu a:link
{
        background: none repeat scroll 0 0 #E6B662;
        color:#000000;
        font:bold 14px arial;
        padding:5px 8px 5px 5px;
        text-decoration : none;
}
.tabmenu a.active
{
        background : none repeat scroll 0 0 #F9F9F3;
        border-bottom : 3px solid #F9F9F3;
        color : #000000;
}
#navigation ul
{
list-style: none;
padding: 0;
margin: 0
}
.tabmenu li
{
display: inline;
list-style-type:none;
float: left;
margin: 0;
margin-left : -41px;
margin-right: 45px;
}
</style>

<% if params["load"] == "conf" %>
        <body onLoad="new Ajax.Updater('maindiv', '/processmonitoring/conflist', {asynchronous:true, evalScripts:true});return false;">
<% else %>
        <body onLoad="new Ajax.Updater('maindiv', '/processmonitoring/monitor', {asynchronous:true, evalScripts:true});return false;">
<% end %>
<div id="tabmenu" class="tabmenu" style="position: absolute;width : 100%">
<ul id="navigation">
                       <li><span><%= link_to "Monitor", :update => "maindiv" ,:url => { :controller => 'processmonitoring', :action => 'monitor'  },  :complete => 'reset();',  :method => 'get'  %></span></li>

                       <li><span><%= link_to "Configuration", :update => "maindiv" , :load => "conf" ,  :url => { :controller => 'processmonitoring', :action => 'conflist' } %><span></li>

</ul>
</div>
<br><br><br>
<div style="clear:both" ></div>
<div id="maindiv">
</div>
</body>

2 个答案:

答案 0 :(得分:1)

我知道这是一个老问题,但它可以为其他人节省一些时间:

我今天遇到了同样的问题,我的CSS风格是根本原因:

body * {
   display: inline; // or any display value other than none
}

*还包含script标记。

答案 1 :(得分:0)

我不确定这一点,但是你可以将你的整个数据放在标签之间并将所有的样式和javascript标签放在其间,并检查是否有帮助

确保您的页面符合此模式

<!DOCTYPE html>
<html>
<head>
    <title>Web page title</title>
    <script type="text/javascript" src="script.js"></script>
</head>
<body>
    <!-- HTML code here -->
</body>
</html>