小编ell*_*eek的帖子

检测浏览器是IE 7还是更低?

因此,我将向我的网站添加一个重定向,将每个使用7或更低版​​本的用户折腾到另一个页面,然后想出这个JavaScript,但它似乎停止了工作.

<script type="text/javascript">
 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
  var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
   if (ieversion<=8)
    window.location = "ie.html" 
   }
   window.location = "main.html"
</script>
Run Code Online (Sandbox Code Playgroud)

html javascript internet-explorer

14
推荐指数
2
解决办法
2万
查看次数

php中的动态标题

我试图让页面标题(<title>bla..bla..bla..</title>)在php中具有多文件布局,如下所示:Functions.php包含在index.php中,然后从functions.php调用get_header()以包含页眉. php标题标签位于头文件中.我希望能够从index.php设置标题我该怎么做?

例如,这是我尝试过的:
Index.php:

<? require_once('includes/functions.php'); global $t; $t = '/home/s0urc3'; get_header();?>

<div id="main">

    <h2><a href="NEEDED" rel="bookmark" title="Permanent Link to NEEDED">NEEDED</a></h2>


    <p class="postmeta"><a href="<?php page_url(yes)?>" class="readmore">Permalink</a> | <span class="date">Revision Date</span></p>

        <p>CONTENT AND CRAP</p>

    <!-- main ends -->  
</div>
<?php /*test*/echo($title);/*test*/ get_footer();?>
Run Code Online (Sandbox Code Playgroud)

header.php文件:

<?php //include('functions.php')?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<? title('$t')?>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<?php get_theme_css()?>
</head>

<body>
<!-- wrap starts here -->
<div id="wrap">

    <!--header -->
    <div id="header">               
        <h1 id="logo-text"><a href="<?php echo (HOME)?>"><img …
Run Code Online (Sandbox Code Playgroud)

php variables function title

1
推荐指数
1
解决办法
3366
查看次数

我得到零除错误但无法弄清楚原因

错误发生在这一行:

return(rand()% sides + 1);
Run Code Online (Sandbox Code Playgroud)

这是我的计划:

//  main.cpp
//  dcChecker
//
//  Created by Max Huber on 2/21/13.
//  Copyright (c) 2013 S0URC3 Studioss. All rights reserved.
//

#include <iostream>
#include <ctime>
#include <cstdlib>

int rollDice(int);
int diceCheck(int diceMod, int dci, int roll);
void clearScreen();
void pressEnter();
void dcFunction();


int main()
{
    dcFunction();
    clearScreen();
    main();
}

// Roll a n sided die
int rollDice(int sides)
{
    //int gen;

    //create time variable
    time_t timer;

    //set time variable to current time in …
Run Code Online (Sandbox Code Playgroud)

c++ exception

1
推荐指数
1
解决办法
712
查看次数