开发者

Using a function to get the ID of an element with getElementById()

开发者 https://www.devze.com 2023-02-15 12:08 出处:网络
GET_COOKIE(\'CURRENT_IM\') will re开发者_开发技巧turn a number saved in the CURRENT_IM cookie. How can I get this to work?

GET_COOKIE('CURRENT_IM') will re开发者_开发技巧turn a number saved in the CURRENT_IM cookie. How can I get this to work?

This is in a onClick Attribute

document.getElementById('IM_INNER_'+GET_COOKIE('CURRENT_IM')).style.display='none';


What is not working?

My immediate thought for debugging would be to set a variable. Also, calling the toString() on the integer return value may help.

  var id = 'IM_INNER_'+GET_COOKIE('CURRENT_IM').toString();
  alert(id);  //this will tell you what the id is.  you can view the source to see if it's correct
  document.getElementById(id).style.display='none';
0

精彩评论

暂无评论...
验证码 换一张
取 消