[thelist] JavaScript error.

John Kipling Lewis jklewis at umich.edu
Thu Feb 21 23:33:01 CST 2002


On Thu, 21 Feb 2002, .jeff wrote:

> it's because you've hardcoded your links to use absolute references.  change
> all instances of "http://allclassical.com/" or
> "http://www.allclassical.com/" in <a>, <img>, <script>, <iframe>, <link>,
> <object>, <embed> tags and any other tag that references external media to
> "/".
>
> the most problematic is your pick() function (which you're calling all
> wrong, to begin with):
>
> function pick() {
> x='<iframe width=392 height=406
> src="http://allmusic.com/com/b2k1/'+person+'-'+cat+'.html" align=left
> frameborder="0" id="frametent"></iframe>';
> document.getElementById("tent").innerHTML=x;
> x='<iframe src="http://allmusic.com/com/b2k1/'+person+'.html"
> frameborder="0" id="topnav" scrolling="no" height="30"
> width="260"></iframe>';
> document.getElementById("tnav").innerHTML=x;
> if (cat=="s") {dex="Pop Singles"}
> if (cat=="p") {dex="Pop Albums"}
> if (cat=="r") {dex="Pop Reissues"}
> if (cat=="m") {dex="Movie"}
> if (cat=="d") {dex="DVD"}
> if (cat=="c") {dex="Classical Album"}
> if (cat=="g") {dex="Game"}
> x=name+' &gt; '+dex;
> document.getElementById("title").innerHTML=x;
> }
>
> why write the html out for the <iframe> tag?  why not just change the
> location of the document in the <iframe>?  sure would be a whole lot easier
> and have greater support.

Good point.  I'm still learning the in's and out's of javascript.  This is
my second major attempt at working scripts.

> the lines with the <iframe> tags need to have the "http://allmusic.com/"
> changed to "/".  that should fix your error problems.

Damn, you're right.  I had fixed this once already, and must have made an
error with version control.

> however, you've got *much* bigger problems in your complex reliance on
> javascript and therefore needlessly locking out non-js users.
>
> give this a read and then re-evaluate your strategy, please (begging):
>
> Links and JavaScript Living Together in Harmony
> http://evolt.org/article/thelist/17/20938/

Read, but not completely understood.  It's late for me, so I'll read it
again in the morning.

> good luck,
>
> .jeff

Thanks .jeff!

John -




More information about the thelist mailing list