View Full Version : Passing vars into preview
zoobie
09-08-2002, 02:01 AM
I used to use document.form.graphic.selectedIndex to pass vars into my preview from a drop down box.
I've now changed the format whereas the var from the image viewer is passed into the form directly via document.form.graphic=g_xxx without selection from a drop down box.
What should I use for document.form.graphic.selectedIndex now?
Thanks :p
If you had:
whatever=document.form.graphic.selectedIndex
Then I would have thought:
whatever=document.form.graphic.value
May need to see the script for better idea
zoobie
09-08-2002, 09:48 PM
Let me explain from the top...
I have a image viewer on the page...and a seperate form. I used to have the form with a selection box to choose a graphic. This was called in my preview as
win.document.write('<center><img src="' + graphicURL[document.form.graphic.selectedIndex] + '"></center><br>');
I changed the arrangement around where now, when the "next" button on the imageviewer is clicked, the title of the image is passed into a textbox in the form automatically. However, it's not previewing because the image isn't being selected in the form anymore.
How do I fix the preview graphicURL above?
Imageviewer code:
g_fPlayMode = 0;
g_iimg = 0;
g_imax = 0;
g_ImageTable = new Array();
function ChangeImage(fFwd)
{
if (fFwd)
{
if (++g_iimg==g_imax)
g_iimg=0;
}
else
{
if (g_iimg==0)
g_iimg=g_imax;
g_iimg--;
}
Update();
}
function Update(){
document.all._Ath_Slide.src = g_ImageTable[g_iimg][0];
document.form.graphic.value = g_ImageTable[g_iimg][1]; // This is where the title is being passed into the form.
document.all._Ath_FileName.innerHTML = g_ImageTable[g_iimg][1];
document.all._Ath_Img_X.innerHTML = g_iimg + 1;
document.all._Ath_Img_N.innerHTML = g_imax;
}
function Play()
{
g_fPlayMode = !g_fPlayMode;
if (g_fPlayMode)
{
btnPrev.disabled = btnNext.disabled = true;
Next();
}
else
{
btnPrev.disabled = btnNext.disabled = false;
}
}
function OnImgLoad()
{
if (g_fPlayMode)
window.setTimeout("Tick()", g_dwTimeOutSec*1000);
}
function Tick()
{
if (g_fPlayMode)
Next();
}
function Prev()
{
ChangeImage(false);
}
function Next()
{
ChangeImage(true);
}
function main()
{
Update();
}
g_ImageTable[g_imax++] = new Array ("American_Images/blank_blue.gif","END");
g_ImageTable[g_imax++] = new Array ("American_Images/walkingahead_S.gif","ABOVE IT ALL");
g_ImageTable[g_imax++] = new Array ("American_Images/stooges.gif","3 STOOGES");
g_ImageTable[g_imax++] = new Array ("American_Images/head.gif","WEEDHEAD");
g_ImageTable[g_imax++] = new Array ("American_Images/brainy_S.gif","NO BRAINER");
g_ImageTable[g_imax++] = new Array ("American_Images/alfred_S.gif","ALFRED");
g_ImageTable[g_imax++] = new Array ("American_Images/clown.gif","JESTER");
g_dwTimeOutSec=2
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.