Hi
Prelude:
This is a continuation of a thread at:
and also a previous post, regards to which I am thankful to Dan (RayPreachersSon??)for answering a question there. Since I have more questions, with enough meat to fill a franfurter factory, I decided on a new post.
Background:
In the slide show code there are, say, three images put in an array, (with their URLs or directory filenames):
if (document.images) {
adImages = new Array(
"/Dir/Sub/Subsub/Hawaiian_Hula.jpg",
"/Dir/Sub/Subsub/Halloween_Party.png",
"/Dir/Sub/Subsub/Dog's_bones,_&_cats.gif");
. . .
Further in the program it refers to a text field where a description of the slide appears beside it. The original "description" was just the URL: in the above mentioned thread Dan showed code for shortening these to:
Hawaiian_Hula
Halloween_Party and
Dog's_bones,_&_cats
. . .which is far more effective.
QUESTIONS:
1. Is it possible to edit the above further to replace, for example, the underscore with a space?
2. For other characters eg the apostrophe ', comma , and ampersand & the filename is probably (almost certainly??!;o) made invalid. eg
"/Dir/Sub/Subsub/Dog's_bones,_&_cats.gif");
To bypass this, it could be renamed as:
"/Dir/Sub/Subsub/DogQs_bonesX_Z_cats.gif");
and a Javascript function used for the textfield to replace the character Q with an apostrophe. (I realize there is a restriction on there being no Q, X or Z in the URL/filenames - that's not a big issue.
Actually, 1. and 2. could be combined into a Javascript function to replace a given character with any other (eg like a cypher code.) What would this look like?
3. In the above URLs the /Dir/Sub/Subsub/ is common to all three. Is it possible to truncate up to and including the last slash character / in the case of files in different directories?
4. I have read in the PHP language of a way to verify, or alter strings using preg_match (?) Is it possible to embed PHP code within Javascript - Head & Body sections? - of HTML?
As this is a Javascript forum, I'm not expecting m/any answers to 4. I'd really like answers to 1. & 2. - 3. would be a bonus. Again, any help/comments would be most appreciated.
David
Prelude:
This is a continuation of a thread at:
and also a previous post, regards to which I am thankful to Dan (RayPreachersSon??)for answering a question there. Since I have more questions, with enough meat to fill a franfurter factory, I decided on a new post.
Background:
In the slide show code there are, say, three images put in an array, (with their URLs or directory filenames):
if (document.images) {
adImages = new Array(
"/Dir/Sub/Subsub/Hawaiian_Hula.jpg",
"/Dir/Sub/Subsub/Halloween_Party.png",
"/Dir/Sub/Subsub/Dog's_bones,_&_cats.gif");
. . .
Further in the program it refers to a text field where a description of the slide appears beside it. The original "description" was just the URL: in the above mentioned thread Dan showed code for shortening these to:
Hawaiian_Hula
Halloween_Party and
Dog's_bones,_&_cats
. . .which is far more effective.
QUESTIONS:
1. Is it possible to edit the above further to replace, for example, the underscore with a space?
2. For other characters eg the apostrophe ', comma , and ampersand & the filename is probably (almost certainly??!;o) made invalid. eg
"/Dir/Sub/Subsub/Dog's_bones,_&_cats.gif");
To bypass this, it could be renamed as:
"/Dir/Sub/Subsub/DogQs_bonesX_Z_cats.gif");
and a Javascript function used for the textfield to replace the character Q with an apostrophe. (I realize there is a restriction on there being no Q, X or Z in the URL/filenames - that's not a big issue.
Actually, 1. and 2. could be combined into a Javascript function to replace a given character with any other (eg like a cypher code.) What would this look like?
3. In the above URLs the /Dir/Sub/Subsub/ is common to all three. Is it possible to truncate up to and including the last slash character / in the case of files in different directories?
4. I have read in the PHP language of a way to verify, or alter strings using preg_match (?) Is it possible to embed PHP code within Javascript - Head & Body sections? - of HTML?
As this is a Javascript forum, I'm not expecting m/any answers to 4. I'd really like answers to 1. & 2. - 3. would be a bonus. Again, any help/comments would be most appreciated.
David