<img src=javascript:alert("test") >

博客展示了一段代码 <img src=javascript:alert(\test\) >,体现了JavaScript在图片标签中的应用,利用JavaScript代码实现弹窗功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

"><img src=javascript:alert("test") >
<html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>www.qiandu.com</title> </head> <body> <h1>wasai</h1> <p id='123'>不错</p> <img src="1.jpg"> <audio src="1.mp3">asd</audio> <video src="2.mp4">视频</video> <table border="1"> <caption>aaa</caption> <tr> <th>序号</th> <th>姓名</th> <th>性别</th> <th>年龄</th> </tr> <tr> <td>1</td> <td>张三</td> <td>男</td> <td>18</td> </tr> <tr> <td>2</td> <td>王五</td> <td>男</td> <td>22</td> </tr> </table> <br> <a href="login.html">登陆</a> <form action="login.php" method="get" onclick="alert('')"> <script> function test() { var a=document.getElementById('username').value; var a=document.getElementById('password').value; alert("用户名:" + username + "\n密码:" + password); return false; // 阻止表单提交 } </script> 用户:<input type="text"id="username" name="username"><br> 密码:<input type="password" id="password" name="password"><br> 男:<input type="radio" name="sex" value="nan"> 女:<input type="radio" name="sex" value="nv"><br> 打游戏:<input type="checkbox" name="xq[]"> 听音乐:<input type="checkbox" name="xq[]"> 看小说:<input type="checkbox" name="xq[]"><br> <select id="2" name="city" > <option>成都</option> <option>广安</option> <option>北京</option> </select> <input type="file" name="file"> <textarea id="1" name="" rows="5" cols="4"></textarea> <input type="button" value="提交" name= "" > <button>注册</button> </form> <script src="test.js"></script> </body> </html>
03-08
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>前端网-登录注册</title> </head> <body> <h1>wasai</h1> <p id="p1">不错</p> <img src="1.jbg" alt="示例图片"> <table border="1"> <caption>用户信息表</caption> <tr> <th>序号</th> <th>姓名</th> <th>性别</th> <th>年龄</th> </tr> <tr> <td>1</td> <td>张三</td> <td>男</td> <td>18</td> </tr> <tr> <td>2</td> <td>王五</td> <td>男</td> <td>22</td> </tr> </table> <br> <a href="login.html">登录</a> <form action="login.php" method="post" onsubmit="return test()"> <script> function test() { const username = document.getElementById('username').value; const password = document.getElementById('password').value; alert(`用户名:${username}\n密码:${password}`); return false; // 阻止表单提交 } </script> <label>用户:<input type="text" id="username" name="username" required></label><br> <label>密码:<input type="password" id="password" name="password" required></label><br> 男:<input type="radio" name="sex" value="male" required> 女:<input type="radio" name="sex" value="female"><br> 打游戏:<input type="checkbox" name="hobby[]" value="gaming"> 听音乐:<input type="checkbox" name="hobby[]" value="music"> 看小说:<input type="checkbox" name="hobby[]" value="novel"><br> <select id="city" name="city"> <option value="chengdu">成都</option> <option value="guangan">广安</option> <option value="beijing">北京</option> </select> <input type="file" name="file"> <textarea id="comment" name="comment" rows="5" cols="20"></textarea> <input type="submit" value="提交"> <button type="button">注册</button> </form> <script src="test.js"></script> </body> </html> 添加if来判断密码输入错误
03-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值