要实现的功能是点击图片后test的代码换成登陆代码代码如下请各位大大帮忙!
谢谢<html>
<head>
<title>无标题文档</title>
<script type="text/javascript">function loadLogin() { document.getElementById("test").innerHTML = "<form><p>用户名<input name="textfield" type="text" id="textfield" size="10" maxlength="12" /><br />密 码<input name="textfield2" type="text" id="textfield2" size="10" maxlength="12" /><br /><input type="submit" name="button" id="button" value="登陆" /><input type="reset" name="button2" id="button2" value="重置" /></p></form>";}</script>
</head><body><table width="200" border="1" cellspacing="1" cellpadding="1">
<tr>
<td id="test"><img src="http://www.csdn.net/Images/logo_csdn.gif" width="150" height="60" onClick="loadLogin();"/></td>
</tr>
</table>
</body>
</html>
谢谢<html>
<head>
<title>无标题文档</title>
<script type="text/javascript">function loadLogin() { document.getElementById("test").innerHTML = "<form><p>用户名<input name="textfield" type="text" id="textfield" size="10" maxlength="12" /><br />密 码<input name="textfield2" type="text" id="textfield2" size="10" maxlength="12" /><br /><input type="submit" name="button" id="button" value="登陆" /><input type="reset" name="button2" id="button2" value="重置" /></p></form>";}</script>
</head><body><table width="200" border="1" cellspacing="1" cellpadding="1">
<tr>
<td id="test"><img src="http://www.csdn.net/Images/logo_csdn.gif" width="150" height="60" onClick="loadLogin();"/></td>
</tr>
</table>
</body>
</html>
解决方案 »
- js如何判断一个变量的值为空?
- asp.net页面无法写入javascript
- 一个关于二级联动的问题
- |zyciis | FireFox IE AJAX 一个XMLHTTP谁帮我改一下在FireFox里面可以用 第三贴 为什么我返回的是[Object] 而不是String呢 谢谢
- 如何获取用户浏览器安装了那些插件?
- window.open()的问题,大家近来看看。
- 关于验证 日期的js脚本。
- 点击不同的小图后,相应的大图同时在同一地方出现。
- 怎样调用vbs里的类
- 正则表达式的简单问题
- javascript实现下来菜单效果在IE上可以实现,为什么在Firefox不可以实现?
- 尚未声明变量"dlgHelper"
function loadLogin() ===》function loadLogin(obj)document.getElementById("test").innerHTML ===》objonClick="loadLogin();" ===》 onClick="loadLogin(this)"
fundocument.getElementById("test").innerHTML ===》obj.innerHTML
<head>
<title>无标题文档</title>
<script type="text/javascript">function loadLogin(obj) { obj.innerHTML = "<p>用户名<input name="textfield" type="text" id="textfield" size="10" maxlength="12" /><br />密 码<input name="textfield2" type="text" id="textfield2" size="10" maxlength="12" /><br /><input type="submit" name="button" id="button" value="登陆" /><input type="reset" name="button2" id="button2" value="重置" /></p>";}</script>
</head><body><table width="200" border="1" cellspacing="1" cellpadding="1">
<tr>
<td id="test"><img src="http://www.csdn.net/Images/logo_csdn.gif" width="150" height="60" onClick="loadLogin(this);"/></td>
</tr>
</table>
</body>
</html>
还是不行
<head>
<title> 无标题文档 </title>
<script type="text/javascript"> function loadLogin(obj) {
obj.innerHTML = '<p> 用户名 <input name="textfield" type="text" '
+'id="textfield" size="10" maxlength="12" /> <br />'
+'密 码 <input name="textfield2"'
+' type="text" id="textfield2" size="10" maxlength="12" /> '
+'<br /> <input type="submit" name="button" id="button" '
+'value="登陆" /> <input type="reset" name="button2" id="button2" value="重置" /> </p>';
} </script>
</head> <body> <table width="200" border="1" cellspacing="1" cellpadding="1">
<tr>
<td id="test"> <img src="http://www.csdn.net/Images/logo_csdn.gif" width="150" height="60" onClick="loadLogin (this.parentNode);"/><!--this.parentNode取到td行--> </td>
</tr>
</table>
</body>
</html>
<head>
<title> 无标题文档 </title>
<script type="text/javascript"> function loadLogin(obj) {
obj.innerHTML = '<p> 用户名 <input name="textfield" type="text" '
+'id="textfield" size="10" maxlength="12" /> <br />'
+'密 码 <input name="textfield2"'
+' type="text" id="textfield2" size="10" maxlength="12" /> '
+'<br /> <input type="submit" name="button" id="button" '
+'value="登陆" /> <input type="reset" name="button2" id="button2" value="重置" /> </p>';
} </script>
</head> <body> <table width="200" border="1" cellspacing="1" cellpadding="1">
<tr>
<td id="test"> <img src="http://www.csdn.net/Images/logo_csdn.gif" width="150" height="60" onClick="loadLogin (this.parentNode);"/><!--this.parentNode取到td行--> </td>
</tr>
</table>
</body>
</html>