無論出於何種原因,我不能讓下面的代碼在IE9在所有的工作工作,但在Firefox,Chrome和歌劇作品:代碼與Internet Explorer 9
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Laughing Man Productions²-Administrator Portal</title>
<!--[if !IE 9]> <!--><link rel="stylesheet" type="text/css" href="http://www.lmpgames.com/WEB401/W2/css/login_page.css"/><!--<![endif]-->
<!--[if IE 9]>
<link rel="stylesheet" type="text/css" href="http://www.lmpgames.com/WEB401/W2/css/login_page_IE.css"/>
<![endif]-->
</head>
<body>
<div class="login_bg">
<form action="" method="post" enctype="multipart/form-data">
<fieldset class="fset">
<div class="username_text">
Username/Email Address:
<span class="username_field">
<input name="txtbUName" type="text" style="background-color:#DDDDDD;" value="Username" size="20" maxlength="60" />
</span>
</div><br/>
<div class="password_text">
Password:
<span class="password_field">
<input name="txtbPWord" type="password" style="background-color:#DDDDDD;" value="Password" size="20" maxlength="16" />
</span>
</div><br/>
<div class="sub">
<input name="btnSubmit" type="button" onclick="formatUName(this.form)" value="Submit" />
</div>
<textarea name="txtaFOutput" class="txta" cols="1" rows="1">
</textarea>
</fieldset>
</form>
</div>
<script type="application/javascript">
function formatUName(form)
{
//Set up variables and references for use later on
var button = form.btnSubmit;
var txta = form.txtaFOutput;
var username = form.txtbUName;
var password = form.txtbPWord;
var uName = "default";
var pWord = "";
uName = username.value; //Obtain the value of the username field on submit
//Then remove spaces from the value and change all letters to uppercase
uName = uName.replace(/\s+/g, '');
uName = uName.toUpperCase();
//Finally print the formatted username to the textarea
txta.value = uName + " is your username";
}
</script>
</body>
</html>
當我加載網頁起來IE並單擊提交沒有任何反應。我試圖將.value更改爲innerHTML和innerText,但它們都不在IE中工作。
編輯:
與IE擺弄周圍後我終於設法得到調試運行,它吐出來,這樣的錯誤:
Line: 23 Error: Unable to get value of the property 'appendChild': object is null or undefined
編輯2:
忽略前面的錯誤。 IE允許Vuze通過我不知道Vuze安裝的插件注入Javascript代碼。禁用它們,現在新的錯誤消息,是關於我的函數名稱:
Line 35: The value of the property 'formatUName' is null or undefined, not a Function object
你的註釋語法是明確錯誤。使用'//'作爲行註釋 – Bergi
你在IE中遇到任何錯誤嗎?你有沒有試過調試它,直到它的部分工作? – Bergi
@Bergi更改評論標籤反斜槓沒有改變。至於調試我不能。根據IE的開發工具,我的函數沒有可執行代碼,因此腳本標記中的斷點是無效的。 – Geowil