开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜