我需要一个javascript中的正则表达式,它只接受正数和小数.这就是我所拥有的,但有些事情是错误的 - 它似乎没有单个正数.
/^[-]?[0-9]+[\.]?[0-9]+$/;
Run Code Online (Sandbox Code Playgroud)
例如,9不起作用.我怎样才能对其进行重组,如果至少有一个正数,它会起作用?
到目前为止,我的代码是从.txt文件中读取,通过html解析信息和输出.我的问题是如何将我的$ name和$ email变量回显到一个双列表中?
这是我的代码:
<?php
// Read the file into an array
$users = file("names.txt");
// Cycle through the array
foreach ($users as $user) {
// Parse the line, retriving the name and e-mail address
list($name, $email) = explode(" ", $user);
// Remove newline from $email
$email = trim($email);
// Output the data...how could I do this with a two-column table?
echo "<a href=\"mailto:$email\">$name</a> <br />";
}
?>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
无论我尝试做什么,我都无法修改链接的颜色(想要创建颜色翻转效果).它们始终与下划线效果保持相同的默认蓝色.我知道它做得很小,我做错了,但是有人能说出来吗?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<style type="text/css">
body,
html {
margin:0;
padding:0;
color:#101010;
font-family: helvetica;
}
p {
margin:10px 0 0 20px;
font-size: 13px;
line-height: 1.3em;
padding-bottom: 10px;
}
#wrapper {
width:960px;
margin:0 auto;
padding: 0px;
background:#fff;
}
#header {
padding:5px 10px;
background:#fff;
height:518px;
}
#nav {
padding:5px 10px;
background:#fff;
width: 960px;
height: 35px;
position: absolute;
top: 370px;
font-size: 18px;
color: #000;
}
#nav ul {
margin:0;
padding:0;
list-style:none;
position: absolute;
bottom: 5px;
} …Run Code Online (Sandbox Code Playgroud)