muscle
07-07-2003, 09:58 PM
I've got a coldfusion app I've built, but now needs to be static for a cdrom. In one particular part, I'm passing the following variables...
<a href="javascript:pop_window('slideview.cfm?presentation=1&slide=1')" name="slide1">
Then in my slideview.cfm page, I'm pulling the two variable and displaying them like so...
<img src="#presentation#/slides/Slide#slide#.jpg" width="400" height="300" border="0" alt="">
Is there a way to do this with javascript? Thanks beforehand!!
Arielladog
07-07-2003, 10:48 PM
Hey muscle,
Read the JavaScript FAQ as it's in there:
http://www.webxpertz.net/faqs/jsfaq/passvars.php#formurl
Then, you could just use something like:
document.write('<img src="' + search["presentation"] + '/slides/Slide' + search["slide"] + '" width="400" height="300" border="0" alt="">');
aDog :cool:
muscle
07-08-2003, 05:07 PM
Thank you soo much for the prompt response and answer. I usually check that forum post before, but for some reason I neglected to this time. Thanks again. I was hoping to ask you a second question. I'm a coldfusion guy, so I'm still trying to get this javascript stuff down. I'm using the following snippet of code to determine if a next/previous button should be shown and then having it link to the next slide like so...
<cfif theSlidePosition neq 1>
<a href="slideview.cfm?presentation=#presentation#&slide=#ListGetAt(slideNum,(theSlidePosition - 1))#"><img src="../assets/headers/previous.gif" width="81" height="20" border="0" alt="Previous"></a>
<cfelse> </cfif>
<cfif theSlidePosition neq listLen(slideNum)>
<a href="slideview.cfm?presentation=#presentation#&slide=#ListGetAt(slideNum,(theSlidePosition + 1))#"><img src="../assets/headers/next.gif" width="57" height="20" border="0" alt="Next"></a>
<cfelse> </cfif>
so for example, if it's slide 1, you wouldn't see a previous button, but you would see a next button with a link to the next one. Is there a way to accomplish this in javascript, or am I shooting up the wrong tree. Thanks beforehand!!!
Modified code...
<html>
<head>
<title>Preceptorship Training Manual</title>
<script type="text/javascript">
//<![CDATA[
function parseSearchString()
{
var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
for (var i=0;i<pairs.length;i++){
var pair = pairs[i].split('=');
this[pair[0]]=pair[1];
}
}
var search = new parseSearchString();
//output passed variables
document.write('<div align="center">');
document.write('<img src="' + search["presentation"] + '/slides/Slide' + search["slide"] + '.jpg' + '" width="400" height="300" border="0" alt="">');
document.write('</div>');
//]]>
</script>
</head>
<body leftmargin="10" topmargin="10" marginheight="10" marginwidth="10" bgcolor="#ffffff">
</body>
</html>
vBulletin® v3.6.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.