我有以下CSS:
td: hover {
background-color:red;
}
td {
cursor: pointer;
background-color: rgb(150,150,150);
}
Run Code Online (Sandbox Code Playgroud)
我的HTML只是:
<table>
<tr><td> </td></tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我无法hover上班.这是为什么?
function Account(password, email)
{
this.password=password;
this.email=email;
}
function createAccount()
{
var username="Moshiko22";
var password="1112"
var email="moshiko@walla.co.il";
username=new Account(password, email);
}
Run Code Online (Sandbox Code Playgroud)
第一个函数是构造函数.假设'用户','密码'是用户输入的,我想创建一个名为USER输入的帐户对象.(因为在对象中将是用户输入的'用户名').我知道为什么我所做的不起作用,但我不知道如何实现它.提前致谢!
很抱歉不清楚:用户输入用户名,密码和电子邮件.密码和电子邮件只是对象"帐户"中的2个属性.用户名是我想要的对象本身.
我很想了解之间的区别:
var the_timeout = setTimeout("alert(the_string);", 60000);
Run Code Online (Sandbox Code Playgroud)
和:
var the_timeout = setTimeout("alert(" + the_string + ");",60000);
Run Code Online (Sandbox Code Playgroud)
我知道第一个传递变量,第二个传递值 - 但这究竟是什么意思,为什么重要?为什么在第二个例子中传递了值?
另外(我希望这是同一个主题),为什么这个工作:
var timeout=setTimeout("someFunction();", 3000)
Run Code Online (Sandbox Code Playgroud)
虽然这不是:
var timeout=setTimeout(someFunction(),3000);
Run Code Online (Sandbox Code Playgroud)
调用函数时,someFunction()工作,所以为什么我在使用时必须添加引号setTimeout()?
使用Javascript:
function capitalizeFL(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
Run Code Online (Sandbox Code Playgroud)
PHP:
echo "You have chosen a <script>document.write(capitalizeFL(".$race."));</script>";
Run Code Online (Sandbox Code Playgroud)
$race包含一个字符串.我想要的只是$race使用上面的Javascript函数来大写php变量的第一个字母,并将其打印在页面上.
我可以找到另一种方法来做到这一点,但这个JS-PHP混合的东西让我感到困惑,我非常想弄清楚为什么这不起作用.
我有这个Javascript函数:
function capitalizeFL(string) { //takes a string, returns it with first letter capitalized
return string.charAt(0).toUpperCase() + string.slice(1);
}
Run Code Online (Sandbox Code Playgroud)
一个名为的文件statuswindow.php,其中包括以下内容:
<?php
$raceV = "<script>document.write(capitalizeFL(\"".$player->race."\"));</script>";
$clasV = "<script>document.write(capitalizeFL(\"".$player->clas."\"));</script>";
echo "You have chosen a " . $raceV. " " .$clasV ."!";
?>
Run Code Online (Sandbox Code Playgroud)
现在是主文件,它使用ajax更新并显示玩家的类和种族($clas,$race),在使用capitalizeFL以下内容大写首字母后:
主文件包括以下内容:
$("button").click(function() {
$("#topMenu").load("statuswindow.php");
});
Run Code Online (Sandbox Code Playgroud)
我想要发生的是,html from statuswindow.php将在主窗口的#topMenudiv中正确显示.
我假设问题是由于document.write覆盖了整个页面.问题是,如何在不使用的情况下执行以下操作document.write?
我正在制作一个需要随机化东西的小型Web应用程序.只是它的一个小例子:向用户返回10和10之间的随机数.
我打算用Javascript和jQuery(计算器本身)来做.
我的问题是:如何使其功能真正随机而不是伪随机?PHP函数可能比Javascript更随机吗?
为了这个问题,让我们说我想要的是X和Y之间的真正随机数.
javascript ×5
php ×3
html ×2
jquery ×2
ajax ×1
constructor ×1
css ×1
hover ×1
html-table ×1
random ×1
timeout ×1
variables ×1