我有这个示例代码:
<div id="click-test-1">Click test 1</div>
<div id="click-test-2">Click test 2</div>
Run Code Online (Sandbox Code Playgroud)
在jQuery中我使用以下代码:
jQuery("div[id^=\'click-test\']").click(...);
Run Code Online (Sandbox Code Playgroud)
如何在基本JavaScript中获得相同的功能?
<ul>
<li>number</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
和样式表:
ul {
list-style-type: none
}
ul li {
float: left;
}
li:after {
content: ", "
}
li:before {
content: ": "
}
li:last-child:after {
content: "."
}
li:first-child:before {
content: ""
}
Run Code Online (Sandbox Code Playgroud)
结果是:
number, 1, 2, 3, 4, 5.
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题:
number: 1, 2, 3, 4, 5.
Run Code Online (Sandbox Code Playgroud) 我有一个示例代码:
<?php
$string = '07/01/2014'; // today format d/m/YY
echo date("m-d-Y", strtotime($string)); // result is 07-01-2014
?>
Run Code Online (Sandbox Code Playgroud)
=>如何修复它的结果是01-07-2014今天的格式m-d-Y
我有一个样本
<h3>How to elasticity of the char length in javascript or css<h3>
<h3>How to elasticity<h3>
Run Code Online (Sandbox Code Playgroud)
如果字符串很长,如何配置字符串的大小
<h3>How to elasticity of ...<h3>
<h3>How to elasticity<h3>
Run Code Online (Sandbox Code Playgroud)
怎么样这个想法
在db.php我有:
<?php
class connect {
private $host = "localhost";
private $user = "root";
private $pass = "";
private $database = "databasename";
private $connect = null;
function connect() {
$this->connect = mysql_connect($this->host, $this->user, $this->pass) or die("Can't connect database");
mysql_select_db($this->database, $this->connect);
}
function getData() {
$data = array();
$sql = 'Select * From test';
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)) {
$data[] = array($row['id'], $row['name']);
}
return $data;
}
}
?>
Run Code Online (Sandbox Code Playgroud)
在index.php我有:
<?php
include 'db.php';
$connect = new connect();
$connect->connect(); …Run Code Online (Sandbox Code Playgroud) 我有一个代码PHP
foreach ($cities as $city) {
echo substr($city->name . ", ", 0, -2);
}
Run Code Online (Sandbox Code Playgroud)
结果是:a,b,c,d,e,
如何在foreach()中删除","
确切地说:a,b,c,d,e