Figured out the answer is:
img_node.removeAttribute("width",0);
img_node.removeAttribute("height",0);
I have a page specific chrome extension I am developing that does stuff to pages on a forum I frequent. (http://code.google.com/p/orpcastmanagerchromeextension/wiki/About)
I have a way for people to replace people’s avatars with a custom url in specific groups of threads (these users are players in a play by post game).
The forum sets people’s avatar img to width=60 and heigh=60:
<img src="https://urlforSinbadEVsavatar" width="60" height="60" alt="SinbadEV's Avatar" border="0" title="SinbadEV's Avatar">
but I want people to be able to specify that they not have the static img size…
assuming that img_node is the node of the img.
I tried:
img_node.width = "100%";
img_node.height= "100%";
and get a 0x0 image:
<img src="https://urlforSinbadEVsavatar" width="0" height="0" alt="SinbadEV's Avatar" border="0" title="SinbadEV's Avatar">
I tried:
img_node.width = "";
img_node.height= "";
and get a 0x0 image:
<img src="https://urlforSinbadEVsavatar" width="0" height="0" alt="SinbadEV's Avatar" border="0" title="SinbadEV's Avatar">
I tried:
img_node.style.width = "100%";
img_node.style.height= "100%";
and get 1×60 image:
<img src="https://urlforSinbadEVsavatar" width="60" height="60" alt="SinbadEV's Avatar" border="0" title="SinbadEV's Avatar" style="width: 100%; height: 100%; ">
I tried:
delete img_node.width;
delete img_node.height;
and get a 60×60 image:
<img src="https://lh4.googleusercontent.com/-DKJY8ApOJHM/Tt_nTqBCIKI/AAAAAAAAAi0/lGF2J4nLiRo/s60/KindlyDM60x60.png" width="60" height="60" alt="SinbadEV's Avatar" border="0" title="SinbadEV's Avatar">
I want to get rid of the constraint or set it to 100% of it’s original size. What am I missing?
1 Answer