IE name与id重名

本文探讨了HTML中ID与Name属性重名导致的问题。在IE浏览器中,通过document.getElementsByName获取元素时,如果存在ID与Name相同的元素,会导致返回结果错误。文章通过一个具体案例展示了如何定位并解决这一问题。

今日在ie上发现一个奇特的问题关于name与id:

html页面上有一个<select id="ccu"></select>的表情不幸与<input name="ccu" type="checkbox" />的复选框重名。

使用getElementsByName('ccu')取到的集合长度始终不对,怀疑是否为id与name重名,于是改了<select id="ccu"></select>改为<select id="ccuCode"></select>。

调试后果然顺利得到了name="ccu"的checkbox集合对象。

在firefox上没有出现该现象。

运行launch文件检测不到发布的odom话题,以下是launch文件的内容: <?xml version="1.0"?> <launch> <!-- Main entry point for loading a single UR5 into Gazebo, in isolation, in the empty world. A set of ros_control controllers similar to those loaded by ur_robot_driver will be loaded by 'ur_control.launch.xml' (note: *similar*, *not* identical). This bringup .launch file is intentionally given the same name as the one in the ur_robot_driver package, as it fulfills a similar role: loading the configuration and starting the necessary ROS nodes which in the end provide a ROS API to a Universal Robots UR5. Only in this case, instead of a real robot, a virtual model in Gazebo is used. NOTE 1: as this is not a real robot, there are limits to the faithfulness of the simulation. Dynamic behaviour will be different from a real robot. Only a subset of topics, actions and services is supported. Specifically, interaction with the Control Box itself is not supported, as Gazebo does not simulate a Control Box. This means: no Dashboard server, no URScript topic and no force-torque sensor among other things. NOTE 2: users wishing to integrate a UR5 with other models into a more complex simulation should NOT modify this file. Instead, if it would be desirable to reuse this file with a custom simulation, they should create a copy and update this copy so as to accomodate required changes. In those cases, treat this file as an example, showing one way how a Gazebo simulation for UR robots *could* be launched. It is not necessary to mimic this setup completely. --> <!--Robot description and related parameter files --> <arg name="robot_description_file" default="$(dirname)/inc/load_ur5.launch.xml" doc="Launch file which populates the 'robot_description' parameter."/> <arg name="joint_limit_params" default="$(find ur_description)/config/ur5/joint_limits.yaml"/> <arg name="kinematics_params" default="$(find ur_description)/config/ur5/default_kinematics.yaml"/> <arg name="physical_params" default="$(find ur_description)/config/ur5/physical_parameters.yaml"/> <arg name="visual_params" default="$(find ur_description)/config/ur5/visual_parameters.yaml"/> <arg name="transmission_hw_interface" default="hardware_interface/EffortJointInterface" doc="The hardware_interface to expose for each joint in the simulated robot (one of: [hardware_interface/PositionJointInterface, hardware_interface/VelocityJointInterface, hardware_interface/EffortJointInterface])"/> <!-- Controller configuration --> <arg name="controller_config_file" default="$(find ur_gazebo)/config/ur5_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/> <arg name="controllers" default="joint_state_controller left_wheel_velocity_controller right_wheel_velocity_controller eff_joint_traj_controller" doc="Controllers that are activated by default."/> <arg name="stopped_controllers" default="joint_group_eff_controller" doc="Controllers that are initally loaded, but not started."/> <!-- robot_state_publisher configuration --> <arg name="tf_prefix" default="" doc="tf_prefix used for the robot."/> <arg name="tf_pub_rate" default="125" doc="Rate at which robot_state_publisher should publish transforms."/> <!-- Gazebo parameters --> <arg name="paused" default="false" doc="Starts Gazebo in paused mode" /> <arg name="gui" default="true" doc="Starts Gazebo gui" /> <!-- Load urdf on the parameter server --> <include file="$(arg robot_description_file)"> <arg name="joint_limit_params" value="$(arg joint_limit_params)"/> <arg name="kinematics_params" value="$(arg kinematics_params)"/> <arg name="physical_params" value="$(arg physical_params)"/> <arg name="visual_params" value="$(arg visual_params)"/> <arg name="transmission_hw_interface" value="$(arg transmission_hw_interface)"/> </include> <!-- 先加载 PID gains --> <rosparam file="$(find urdf02_gazebo)/config/gazebo_ros_control_params.yaml" command="load"/> <!-- Robot state publisher --> <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"> <param name="publish_frequency" type="double" value="$(arg tf_pub_rate)" /> <param name="tf_prefix" value="$(arg tf_prefix)" /> <param name="delta_t" value="0.02"/> <!-- 20ms偏移 --> </node> <!-- Start the 'driver' (ie: Gazebo in this case) --> <include file="$(dirname)/inc/ur_control.launch.xml"> <arg name="controller_config_file" value="$(arg controller_config_file)"/> <arg name="controllers" value="$(arg controllers)"/> <arg name="gui" value="$(arg gui)"/> <arg name="paused" value="$(arg paused)"/> <arg name="stopped_controllers" value="$(arg stopped_controllers)"/> </include> </launch> 以下是涉及odom的文件: <robot name="my_car_move" xmlns:xacro="http://wiki.ros.org/xacro"> <xacro:macro name="joint_trans" params="joint_name"> <transmission name="${joint_name}_trans"> <type>transmission_interface/SimpleTransmission</type> <joint name="${joint_name}"> <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface> </joint> <actuator name="${joint_name}_motor"> <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission> </xacro:macro> <xacro:joint_trans joint_name="left_wheel2base_link" /> <xacro:joint_trans joint_name="right_wheel2base_link" /> <xacro:joint_trans joint_name="front_wheel2base_link" /> <xacro:joint_trans joint_name="back_wheel2base_link" /> <gazebo> <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so"> <rosDebugLevel>Debug</rosDebugLevel> <publishWheelTF>false</publishWheelTF> <robotNamespace>/</robotNamespace> <publishTf>0</publishTf> <publishWheelJointState>false</publishWheelJointState> <alwaysOn>true</alwaysOn> <updateRate>100.0</updateRate> <legacyMode>true</legacyMode> <leftJoint>left_wheel2base_link</leftJoint> <!-- 左轮 --> <rightJoint>right_wheel2base_link</rightJoint> <!-- 右轮 --> <wheelSeparation>${base_link_radius * 2}</wheelSeparation> <!-- 车轮间距 --> <wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- 车轮直径 --> <broadcastTF></broadcastTF> <wheelTorque>30</wheelTorque> <wheelAcceleration>1.8</wheelAcceleration> <commandTopic>cmd_vel</commandTopic> <!-- 运动控制话题 --> <odometryFrame>odom</odometryFrame> <odometryTopic>odom</odometryTopic> <!-- 里程计话题 --> <robotBaseFrame>base_footprint</robotBaseFrame> <!-- 根坐标系 --> </plugin> </gazebo> </robot> 请基于上述代码,提供解决方案
12-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值