Chrome 扩展程序不起作用,这是我的代码...
//manifest.json
{
"manifest_version": 2,
"name": "auto login",
"description": "With this extension you can auto login.",
"version": "1.0",
"permissions": [ "http://*/*" ],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
// popup.html
<!DOCTYPE HTML>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#submit').click(function(){
var data = document.getElementById("username").value;
localStorage["username"] = data;
});
});
</script>
<title>Hello World!</title>
</head>
<body>
<form name="login">
<fieldset>
<legend>Log In</legend>
<table>
<tr>
<td><label for="username">Username</label></td>
<td><input type="text" name="username" id="username"/></td>
</tr>
<tr>
<td><label for="password">Password</label></td>
<td><input type="password" name="password" id="password"/></td>
</tr>
<tr>
<td><input type="submit" value="verzenden" name="submit" id="submit"/></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
为什么这段代码不起作用?无法使用此脚本保存用户名和密码的值。有人可以帮帮我吗?