Javascript 编辑js div match div代码,该代码在单独的链接上具有不同的结果
标题可能会让人困惑 我的js知识很差,因此需要帮助解决这个问题Javascript 编辑js div match div代码,该代码在单独的链接上具有不同的结果,javascript,php,html,height,current-page,Javascript,Php,Html,Height,Current Page,标题可能会让人困惑 我的js知识很差,因此需要帮助解决这个问题 <script type="text/javascript"> $(".content_R").css({'height':($(".content_L").height()+'px')}); $("#content_R").height($("#content_L").height() - 10); var highestCol = Math.max($(
<script type="text/javascript">
$(".content_R").css({'height':($(".content_L").height()+'px')});
$("#content_R").height($("#content_L").height() - 10);
var highestCol = Math.max($('#content_R').height(),$('#content_R').height());
$('#content_R').height(highestCol);
</script>
显示一个复杂的cms编辑器。。。
似乎会影响脚本,使其100px太短!
我希望将此脚本包含在页脚中(每页都有)
所以我不想一次又一次地重复代码
有没有办法让下面的脚本简单地检查一下
如果网站是
edit-post.php?id='.$row['postID']
如果是这样,则将代码更改为:
<script type="text/javascript">
$(".content_R").css({'height':($(".content_L").height()+'px')});
$("#content_R").height($("#content_L").height() + 100);
var highestCol = Math.max($('#content_R').height(),$('#content_R').height());
$('#content_R').height(highestCol);
</script>
$(“.content_R”).css({'height':($(“.content_L”).height()+'px')});
$(“内容”)高度($(“内容”)高度()+100);
var highestCol=Math.max($('content_R').height(),$('content_R').height());
$('content_R')。高度(最高的列);
提前感谢window.location.pathname将保留当前加载脚本的路径。您可以在运行其余的js之前检查它的值
<script type="text/javascript">
$(".content_R").css({'height':($(".content_L").height()+'px')});
$("#content_R").height($("#content_L").height() + 100);
var highestCol = Math.max($('#content_R').height(),$('#content_R').height());
$('#content_R').height(highestCol);
</script>