我正在从 Delphi 生成一个网页(HTML5)(编写 HTML 代码,保存在临时文件中,然后用嵌入的铬打开它)。我需要在 chromium 浏览器中获取被点击元素的 div id。
这可以实现吗?
代码将类似于:
<!DOCTYPE html>
<html>
<head>
<title>App title</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<header data-role="header" data-position="fixed">
<h1>App header</h1>
</header>
<div data-role="content">
<img src="images/logo.png" />
<b>Autenticate</b>
<form method="POST" action="thelogin.php">
Name: <input type="text" name="name"><br>
Pasword: <input type="password" name="passw"><br>
<input type="submit" value="Login" data-inline="true" data-icon="gear">
</form>
</div>
<footer data-role="footer" data-position="fixed">
<h1>by me</h1>
</footer>
</div>
</body>
</html>
这只是一个例子。HTML 还可以包含 Sliders、DatePickers、TextArea、Select 菜单等...