I'm going to have to fire my javascript guy so I guess I better start relearning all this. ;)
I wrote a little script to change the src of an image.
<script type="text/javascript">
function mine(x){
y=document.getE lementById(x);
y.src="2.png";
}
It works but I noticed that if I want to test the initial value, I have to use 'getAttribute(" src"). This does not work:
if(y.src=="2.pn g") y.src="1.png";
I don't get any errors in the Firefox error console.
if(y.getAttribu te("src")=="2.p ng") y.src="1.png";
I don't understand why I can't just say:
if(y.src=="2.pn g") y.src="1.png";
Or does it just not work that way? iow, I can set it without using getAttribute but I can't test it.
I wrote a little script to change the src of an image.
<script type="text/javascript">
function mine(x){
y=document.getE lementById(x);
y.src="2.png";
}
It works but I noticed that if I want to test the initial value, I have to use 'getAttribute(" src"). This does not work:
if(y.src=="2.pn g") y.src="1.png";
I don't get any errors in the Firefox error console.
if(y.getAttribu te("src")=="2.p ng") y.src="1.png";
I don't understand why I can't just say:
if(y.src=="2.pn g") y.src="1.png";
Or does it just not work that way? iow, I can set it without using getAttribute but I can't test it.
Comment