Document_事件

<!DOCTYPE html>
<html lange="en">      <!-- 设置语音 -->
<head>
 <meta charset="UFT-8"> <!-- 设置编码格式 -->
 <title>Title</title>
 <style>
  img{
   border:0;  /*边框 border*/ 
 }
 </style>
</head>
<body>
 <table border="1" width="300px">
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>1</td><td>2</td><td>3</td></tr>
 </table>
 
 <script>
  
  var trs = document.getElementsByTagName('tr');
  console.log(trs);
  for(var i= 0; i < trs.length; i++){
   /*this 这里是指谁调用这个函数 这个this就指向谁*/
   trs[i].onmouseover = function(){
    this.style.backgroundColor = "red";
   }
   
   trs[i].onmouseout = function(){
    this.style.backgroundColor = "";
   }
  }
  
  function t1(n){
   var tag = document.getElementsByTagName('tr')[n];
   tag.style.backgroundColor="red";
  }
  function t2(n){
   var tag = document.getElementsByTagName('tr')[n];
   tag.style.backgroundColor="";
  }
 </script>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以帮你编写一个Python程序来实现这个需求。你可以使用以下代码: ```python import pymysql # 连接到数据库 conn = pymysql.connect(host='localhost', user='your_username', password='your_password', db='your_database') cursor = conn.cursor() try: # 查询je_document_rel表 cursor.execute("SELECT file_id, file_name FROM je_document_rel") results = cursor.fetchall() for row in results: file_id = row[0] file_name = row[1] # 修改je_document_file表中对应的文件路径名称 new_file_path = '/document/2023/0621/%s' % file_name update_query = "UPDATE je_document_file SET file_path_name=%s WHERE id=%s" cursor.execute(update_query, (new_file_path, file_id)) conn.commit() print("文件路径名称已批量修改成功!") except: print("出现错误,文件路径名称修改失败!") finally: # 关闭连接 cursor.close() conn.close() ``` 在上面的代码中,你需要修改以下参数: - `host`:数据库的主机名 - `user`:数据库的用户名 - `password`:数据库的密码 - `db`:数据库的名称 请确保你已经安装了Python的pymysql模块,你可以使用`pip install pymysql`命令来安装它。另外,你还需要根据实际情况修改查询和更新语句,以适应你的数据库结构。 这段程序会先查询`je_document_rel`表,然后逐行获取文件ID和文件名称,再根据文件名称构建新的文件路径名称,最后更新`je_document_file`表中对应的文件路径名称。执行完毕后,会输出成功或失败的信息。 希望这能帮到你!如果你有任何问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值