Recently, I experimented with changing check boxes with JavaScript. If the
user clicked on the words next to the check box, then the box would be
checked, once checked if the user clicked again, then the box would be
unchecked. I wound up having to apply the same code to the check box itself
in order to get it to work. In addition, I added code that would change the
background image of the page to either a solid color, if checked, or back to
the original image, if unchecked. It did not work. So after changing it some
more and still getting no results (I think I even asked here), I did some
research and found another way to link images directly in JavaScript.
I should make note that all the code was in an external file at the time.
The following is the structure of the site:

-container (the name of the containing folder for all files)
||||||||||||||||||||||||||||||||||
    --index.html (home page where the code will be used)
    --scripts (the scripts folder, contains all the scripts)
    |||||||||||||
    ---scripts.js (the scripts file itself)
    ^^^^^^^^^^
    --styles (stylesheets folder located directly within the container
folder)
    ||||||||||||||
    ---styles.css (contains style declarations)
    ^^^^^^^^^^
    --images  (located directly within the container folder)
    |||||||||||||||||
    ---linkedimage.png (the image to be changed in page background)

I hope the structure above makes sense. Anyway, while linking the image in
the scripts.js file, I found it never switched back, yet the code never
showed any problems. When I found the other way to link images directly in
JavaScript, I changed the image link code to what would amount to being
directly in the HTML file itself: The first is the original way I linked it
the second is the new way.

   - (../images/linkedimage.png);
   - from above, changed to
   - (images/linkedimage.png);

After the change above, the code worked. I went back to reading about the
JavaScript standard, I thought that JavaScript was read like an external CSS
file was read, where you would have to use the (../) part to link to the
image if it was in a different folder one level above the current folder.
(as the first line of code above is.) Is that not how JavaScript works? When
it comes to linked images?

--
Brett P.


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************

Reply via email to