I am trying to manipulate a an image gallery that functions well. Now, I have the ability to pull information from a user's preference pannel and need to place it in the an href="" // And other information in each of the "src" | "url" | "alt".
Any ideas would be truly helpful. This is what I am working with at the moment and it doesn't work (obviously because it is adding code inside a span). Here is what I am starting from:
var title01Span = document.getElementById('title01Span'), //Finds the id that I want
prefs = new gadgets.Prefs(), // Pulls from the user's preferences
yourtitle01 = prefs.getString("title01"); // Pulls the correct string from those preferences
title01Span.innerHTML = yourtitle01; // replaces the span.id with that text but I need to be able to do this in the src / href / url / etc.
Thank you so much! I seriously could use as much help as possible!
You can walk thougth the DOM tree like explain on this page.
But be careful the nodes trees are not the same in all browsers. Some browsers adds nodes (with type!=1) with carriage return in HTML. Then getElementsByTagName and getElementById are probably the best choice to kept your objects...
You can always build id dynamically with forms like : document.getElementById("hrf"+idx) to keep links with ids : hrf0, href1, ...
Then you change their property with myLink.href="the new link" or myImage.alt="the new alt".