why not working

I

icek

call.html
......
<a href="image.htm?photo=images/abc.jpg"><img src="images/abc.jpg">

.......
image.htm

<script language="JavaScript">
var imageToDisplay = window.location.search.substring(1).split("=")[1];
document.write('<img src=" + imageToDisplay + ">');
</script>
 
S

Sudrien

call.html
.....
<a href="image.htm?photo=images/abc.jpg"><img src="images/abc.jpg">

......
image.htm

<script language="JavaScript">
var imageToDisplay = window.location.search.substring(1).split("=")[1];
document.write('<img src=" + imageToDisplay + ">');
</script>

Rather than do the above, I'd suggest somthing more like:

<a href="images/abc.jpg" rel="image"><img src="images/
abc_thumbnail.jpg"></a>

and use a getElementByTagname('a') to assign onclicks. Personal
preference.


but for the second pat (which would be better done server side, with
somthing like php), the line should be

document.write('<img src="' + imageToDisplay + '">');

'<img src="' is a string that needs to be closed, as is '">'.

-Sud.
 
E

Evertjan.

icek wrote on 04 aug 2007 in comp.lang.javascript:
call.html
.....
<a href="image.htm?photo=images/abc.jpg"><img src="images/abc.jpg">

......
image.htm

<script language="JavaScript">

use:

var imageToDisplay = window.location.search.substring(1).split("=")[1];
document.write('<img src=" + imageToDisplay + ">');

bad quotes, use:
 
I

icek

Evertjan. pisze:
icek wrote on 04 aug 2007 in comp.lang.javascript:

call.html
.....
<a href="image.htm?photo=images/abc.jpg"><img src="images/abc.jpg">

......
image.htm

<script language="JavaScript">

use:


var imageToDisplay = window.location.search.substring(1).split("=")[1];
document.write('<img src=" + imageToDisplay + ">');

bad quotes, use:

</script>
Thanks very much ...
 

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
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top