written variable output doesnt work?

B

Bugbear

Thanks to Martin Honnen for the info on
unescape(location.search.substring(1));
It works like a charm. Now the next problem that I am running into is
that I figured I would just be able to plug the variable "args" into
the middle of a write statement to get it to display the image but for
some reason it is not.

Here is the script. When I write just the variable, I get the string
I'm looking for but when I try to add it to other strings, it doesnt
work.

<SCRIPT LANGUAGE="JavaScript">

var args = unescape(location.search.substring(1));

//this works

document.write(args);

//diplays - C:\Documents and Settings\Bobo the Bugbear\My Documents\My
Pictures\000index.jpg


//this doesnt work
document.write('<div align="center"><img src="' + args + '"
border="2"></div>');

</script>

I am at a lost of what it could be that is preventing me from
displaying the write with just the variable "args". Its displaying
where an image would be but no image.

To further test it out, I did:
<SCRIPT LANGUAGE="JavaScript">

var image = unescape(location.search.substring(1));

alert(image); //correct
document.write(image); //correct

var first = "<div align=center><img src=";
var last = " border=2></div>";

alert (first + image + last); //displays correctly
document.write(first + image + last); /doesnt display correctly

</script>

and everything showed correct with both alerts but still nothing would
be written correctly. What am I missing?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top