小编Har*_*345的帖子

跨浏览器CSS 3文本渐变

在我的网站上,我使用文字渐变标题,但它只适用于Chrome和Safari(虽然我没有测试过),下面是我用于渐变的代码.我想知道是否有办法实现相同/类似的效果,可以在所有3个浏览器中使用?

      background: -webkit-linear-gradient(#eee, #333);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
Run Code Online (Sandbox Code Playgroud)

编辑:已发布的其他解决方案的问题是,它只适用于白色背景,正如有人在评论中所说,这对我来说没有用,因为我使用的是灰色背景.

css html5 css3

12
推荐指数
1
解决办法
4万
查看次数

如何检查是否在字段上设置了必需属性

我有一个简单的表单,其中包含一些必填字段.

<form name="form" method="post">
<pre>
<label>     Name: </label><input type="text" name="name" required>
<label>  Address: </label><input type="text" name="add" required>
<label>Telephone: </label><input type="text" name="tel">
<input type="submit" value="Submit Form"> 
</pre>
</form>
Run Code Online (Sandbox Code Playgroud)

我知道您可以使用设置所需的属性document.forms['form']['name'].required = false.但有没有办法可以检查是否设置了必需的属性?我试过使用getattribute()但它只是返回空白.我也尝试使用下面的代码,但它总是执行语句,即使未设置所需的属性(例如在电话字段中).

 if( document.forms['form']['name'].required = true)
     label.innerHTML += " (required)"
Run Code Online (Sandbox Code Playgroud)

有谁知道我可以这样做的方式?

更新:两者都将if语句设置为==而不是=使用hasAttribute工作,谢谢.

javascript forms html5 required

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

PHP函数每次将变量增加1

我已经开始为一个关于生物的游戏编写一个PHP脚本,有4个是/否问题,我想要做的是编写一个函数,它将显示2个按钮,表示是和否,每次运行时给出不同的名称该函数,例如yes1和no1,然后在下次运行该函数时,按钮的名称将为yes2和no2.

我已经尝试过这样做但是它工作不正常,下面是我到目前为止所做的代码,任何帮助都会非常感激.

<?php
session_set_cookie_params(2592000);
session_start();
?>

<html>
<head>
<title>Creature Guessing Game</title>
</head>
<body>
<h1>Creature Guessing Game</h1>
<p> Welcome to the creature guessing game! </p>
<p>Click the button below to start or restart the game </p>

<form method="post" action="Creatures.php">
<input type="submit" name="start" value="Start Game" />
</form>
 <?php
 $questions = array('Does the creature live on land?', 'Does it have wings?', 'Does it live near water?', 'Can it fly?');
 function repeat()
 {
 $number = 0;
 $number++;
 echo "<form method ='post' action='Creatures.php'>
<input type='submit' …
Run Code Online (Sandbox Code Playgroud)

php function expert-system auto-increment decision-tree

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

Div未在section标签内正确嵌套

我正在使用以下HTML和CSS代码来尝试创建一个内部有3个div的部分,问题是即使div位于section标签内,在网页中它们出现在section元素的外部和下方?

HTML代码

<section id="content">
<div class="homebox">
<h3>Who I am</h3>
<p>Here is some text  Here is some text  Here is some text  Here is some text  </p>
</div>

<div class="homebox">
<h3>What I do</h3>
<p> Here is some text  Here is some text  Here is some text  Here is some text  Here is some text  Here is some text   </p> 
</div>

<div class="homebox">
<h3>Where I do it</h3>
<p> Here is some text  Here is some text  Here is some text  Here is …
Run Code Online (Sandbox Code Playgroud)

html css html5 css3

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

将单元格地址的位置存储到VBA中的变量

我在Excel中使用VBA并且我使用函数来查找第一个空行然后添加一些值,之后我需要将单元格的地址传递给另一个函数,但是使用下面的代码我得到运行时错误.firstEmptyRow是一个返回范围的函数,例如$A$280.

Dim addCell as Range

'Find first empty row in the table
With firstEmptyRow

'Enter Values
.Value = taskID
.Offset(0, 1).Value = jobID
.Offset(0, 2).Value = jobName
.Offset(0, 6).Value = taskTypeID
.Offset(0, 8).Value = taskName
.Offset(0, 9).Value = desc
.Offset(0, 11).Value = estMins
.Offset(0, 13).Value = "No"

set addCell = .Address //Gives a runtime error

End With
Run Code Online (Sandbox Code Playgroud)

保存单元格地址的正确方法是什么,以便将其传递给另一个函数?下面是firstEmptyRow的代码

Public Function firstEmptyRow() As Range 'Returns the first empty row in the Schedule sheet

    Dim i, time As Long
    Dim …
Run Code Online (Sandbox Code Playgroud)

excel vba runtime-error excel-vba

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