By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,938 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,938 IT Pros & Developers. It's quick & easy.

add element id to image

P: 2
How would I assign an element id to a string like this one:

Expand|Select|Wrap|Line Numbers
  1. function show_image1() {
  2.   document["portimage"].src =
  3.     portfolioPosts[1 + pageStartingNum - 2][0].src;
  4.   onImage=1;
  5.   reset_numbers(); 
  6.   large_img_f();
  7.   return true;
  8. }
  9.  
Thanks in adv. -S
Nov 10 '11 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Either use setAttribute() or set the ID directly, e.g.
Expand|Select|Wrap|Line Numbers
  1. elem.id = id;
Nov 10 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.