Chrome的Javascript/Html问题
我已经对此进行了大约一个小时的故障排除,没有人知道我的问题。我已经排除了chrome没有加载我的javascript文件的可能性。它装得很好。但它仍然不调用我的函数。这让我相信这是一个html问题。现在,这些功能在firefox和IE中都能完美工作。Chrome必须是麻烦制造者,而且似乎不想正常工作 这是我的职责Chrome的Javascript/Html问题,javascript,php,html,Javascript,Php,Html,我已经对此进行了大约一个小时的故障排除,没有人知道我的问题。我已经排除了chrome没有加载我的javascript文件的可能性。它装得很好。但它仍然不调用我的函数。这让我相信这是一个html问题。现在,这些功能在firefox和IE中都能完美工作。Chrome必须是麻烦制造者,而且似乎不想正常工作 这是我的职责 function default_h1() { document.getElementById('showh1').innerHTML="<h1>Register
function default_h1() {
document.getElementById('showh1').innerHTML="<h1>Register to Play!</h1>";
}
function join_humans() {
document.getElementById('showh1').innerHTML="<h1 id=\"bluefont\">Join the Humans!</h1>";
}
function join_orcs() {
document.getElementById('showh1').innerHTML="<h1 id=\"redfont\">Join the Orcs!</h1>";
}
function human_factions() {
document.getElementById('show').innerHTML="<option value='Human Faction'>Human Faction</option>";
}
function orc_factions() {
document.getElementById('show').innerHTML="<option value='Orc Faction'>Orc Faction</option>";
}
function choose_faction() {
document.getElementById('show').innerHTML="<option value='empty_f'>*Choose</option>";
}
<tr>
<td><h5>Race:</h5></td>
<td class="top" colspan="2"><select name="race">
<option value="empty_r" onclick="choose_faction(), default_h1() ">*Choose</option>
<option value="Humans" onclick="human_factions(), join_humans()">Humans</option>
<option value="Orcs" onclick="orc_factions(), join_orcs()">Orcs</option>
</select><?php if (!empty($errors[7])) echo "$errors[7]"; ?>
</td>
</tr>
<tr>
<td><h5>Faction:</h5></td>
<td class="top" colspan="2"><select id="show" name="faction">
<option value="empty_f">*Choose</option>
</select><?php if (!empty($errors[8])) echo "$errors[8]"; ?>
</td>
</tr>
函数默认值_h1(){
document.getElementById('showh1').innerHTML=“注册播放!”;
}
函数join_humans(){
document.getElementById('showh1').innerHTML=“加入人类!”;
}
函数join_orcs(){
document.getElementById('showh1').innerHTML=“加入兽人!”;
}
功能人_派系(){
document.getElementById('show').innerHTML=“人类势力”;
}
职能兽人派系(){
document.getElementById('show').innerHTML=“Orc派系”;
}
函数choose_party(){
document.getElementById('show').innerHTML=“*Choose”;
}
这是使用这些函数的表格和表单
function default_h1() {
document.getElementById('showh1').innerHTML="<h1>Register to Play!</h1>";
}
function join_humans() {
document.getElementById('showh1').innerHTML="<h1 id=\"bluefont\">Join the Humans!</h1>";
}
function join_orcs() {
document.getElementById('showh1').innerHTML="<h1 id=\"redfont\">Join the Orcs!</h1>";
}
function human_factions() {
document.getElementById('show').innerHTML="<option value='Human Faction'>Human Faction</option>";
}
function orc_factions() {
document.getElementById('show').innerHTML="<option value='Orc Faction'>Orc Faction</option>";
}
function choose_faction() {
document.getElementById('show').innerHTML="<option value='empty_f'>*Choose</option>";
}
<tr>
<td><h5>Race:</h5></td>
<td class="top" colspan="2"><select name="race">
<option value="empty_r" onclick="choose_faction(), default_h1() ">*Choose</option>
<option value="Humans" onclick="human_factions(), join_humans()">Humans</option>
<option value="Orcs" onclick="orc_factions(), join_orcs()">Orcs</option>
</select><?php if (!empty($errors[7])) echo "$errors[7]"; ?>
</td>
</tr>
<tr>
<td><h5>Faction:</h5></td>
<td class="top" colspan="2"><select id="show" name="faction">
<option value="empty_f">*Choose</option>
</select><?php if (!empty($errors[8])) echo "$errors[8]"; ?>
</td>
</tr>
种族:
*选择
人类
兽人
派别:
*选择
救命啊!铬让我伤心=(
更新
我发现这个脚本实际上在IE中也不起作用。所以有些可疑的事情发生了,它必须与调用函数的HTML有关在方法调用后使用分号,在onClick中使用大写字母C
<option value="empty_r" onClick="choose_faction(); default_h1();">*Choose</option>
<option value="Humans" onClick="human_factions(); join_humans();">Humans</option>
<option value="Orcs" onClick="orc_factions(); join_orcs();">Orcs</option>
*选择
人类
兽人
范例
<option id="id" value="empty_r" >*Choose</option>
$("#id").click(function){
choose_faction();
default_h1();
}
*选择
$(“#id”)。单击(函数){
选择_派系();
默认值_h1();
}
我更新了代码,在firefox/ie中仍然有效。在chrome中仍然无效=(