Javascript question
#1
Scooby Regular
Thread Starter
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes
on
0 Posts
I have a page with a list items on it. When I click on the thumbnail of the item I want to be able to bring up the window with all the pictures for that item.
I don't want to use any MS specific code such as ASP.
I want a function that passes a nonfixed number of
parameters into a file for displaying.
For example:
display('name1', 'address', 'pic1.gif', 'pic2.gif');
display('name2', 'address', 'pic1.gif');
display('name3', 'address', 'pic1.gif', 'pic2.gif', 'pic3.gif','pic4.gif');
The display function will write HTML into the file and give a link to a template file which then gets all the parameters and displays them.
If I click on a link I want the template file to be able to list all the pictures that were passed into the display function.
The main reason for this is that I want this to behave like a basic flat file database.
All you need to do is add another line:
display('bob', 'bobs address', 'bob1.gif', 'bob2.gif');
To add bob to the list.
Does that make sense?
Anyone have any javascript that does something similar?
Cheers,
Rich
I don't want to use any MS specific code such as ASP.
I want a function that passes a nonfixed number of
parameters into a file for displaying.
For example:
display('name1', 'address', 'pic1.gif', 'pic2.gif');
display('name2', 'address', 'pic1.gif');
display('name3', 'address', 'pic1.gif', 'pic2.gif', 'pic3.gif','pic4.gif');
The display function will write HTML into the file and give a link to a template file which then gets all the parameters and displays them.
If I click on a link I want the template file to be able to list all the pictures that were passed into the display function.
The main reason for this is that I want this to behave like a basic flat file database.
All you need to do is add another line:
display('bob', 'bobs address', 'bob1.gif', 'bob2.gif');
To add bob to the list.
Does that make sense?
Anyone have any javascript that does something similar?
Cheers,
Rich
#2
Hi Rich,
This is a JS function that I written for displaying images of flowers for my mums shop.
From the HTML page I have small image than goes to a bigger image on calling this :
<a href=# onclick ="javascript:OpenWindow('Bouquets','Classic','bq1. jpg','£20.00');return false">
This will then call the follow javascript function and create a dynamic HTML page depending on the parameters that have been passed in. I've not tried it for passing unlimited parameters like in the C/C++ function declarations where you can specify : Func(x,y,..).
Hope this is of some help !!
Regards
Gary.
function OpenWindow(PageTitle,ImageName,ImagePic,ImagePrice )
{
var str;
var msgWindow;
str ="";
str += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n' +
'<HTML>\n' +
'<HEAD><TITLE>' + PageTitle + '</TITLE>\n' +
'<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">\n' +
'</HEAD>\n' +
'<BODY BGPROPERTIES="FIXED" background="background.jpg">\n' +
'<STYLE TYPE="text/css">\n' +
'BODY {font-size: 10pt; font-family: VERDANA, ARIAL, helvetica;}\n' +
'SPAN { background-color: #6495ED; color:white; font-size: 12pt; font-family: VERDANA, ARIAL, helvetica;}\n' +
'a {font-size: 9pt; color: royalblue; font-family:VERDANA,ARIAL, helvetica; text-decoration: none;}\n' +
'a:visted {color: #0000FF; font-family: VERDANA, ARIAL, helvetica; text-decoration: none;}\n' +
'a:hover {background-color:#6495ED ;color:white; font-family: VERDANA, ARIAL, helvetica; text-decoration: none ;}\n' +
'</STYLE>\n' +
'<center><span>' + ImageName + '</span></center>\n' +
'<table align="center" border="0" CELLSPACING="15" <tr align="center"><td align="center">\n' +
'<img src="' + ImagePic + '" border="0" width="280" height="305" align="MIDDLE" >\n' +
'</td>\n</tr>\n</table>\n' +
'<center><span>' + ImagePrice + '</span></center>\n' +
'<table border="0" width="100%">\n' +
'<tr>\n' +
'<td width="50%" align="right"><a href="javascript:window.close()">Close Window</a></td>\n' +
'</tr>\n' +
'</table>\n' +
'</BODY>\n</HTML>\n';
msgWindow=window.open("","displayWindow",
"height=440,width=400,Toolbar=no,menubar=no")
msgWindow.document.open();
msgWindow.document.write(str);
msgWindow.document.close();
return;
}
This is a JS function that I written for displaying images of flowers for my mums shop.
From the HTML page I have small image than goes to a bigger image on calling this :
<a href=# onclick ="javascript:OpenWindow('Bouquets','Classic','bq1. jpg','£20.00');return false">
This will then call the follow javascript function and create a dynamic HTML page depending on the parameters that have been passed in. I've not tried it for passing unlimited parameters like in the C/C++ function declarations where you can specify : Func(x,y,..).
Hope this is of some help !!
Regards
Gary.
function OpenWindow(PageTitle,ImageName,ImagePic,ImagePrice )
{
var str;
var msgWindow;
str ="";
str += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n' +
'<HTML>\n' +
'<HEAD><TITLE>' + PageTitle + '</TITLE>\n' +
'<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">\n' +
'</HEAD>\n' +
'<BODY BGPROPERTIES="FIXED" background="background.jpg">\n' +
'<STYLE TYPE="text/css">\n' +
'BODY {font-size: 10pt; font-family: VERDANA, ARIAL, helvetica;}\n' +
'SPAN { background-color: #6495ED; color:white; font-size: 12pt; font-family: VERDANA, ARIAL, helvetica;}\n' +
'a {font-size: 9pt; color: royalblue; font-family:VERDANA,ARIAL, helvetica; text-decoration: none;}\n' +
'a:visted {color: #0000FF; font-family: VERDANA, ARIAL, helvetica; text-decoration: none;}\n' +
'a:hover {background-color:#6495ED ;color:white; font-family: VERDANA, ARIAL, helvetica; text-decoration: none ;}\n' +
'</STYLE>\n' +
'<center><span>' + ImageName + '</span></center>\n' +
'<table align="center" border="0" CELLSPACING="15" <tr align="center"><td align="center">\n' +
'<img src="' + ImagePic + '" border="0" width="280" height="305" align="MIDDLE" >\n' +
'</td>\n</tr>\n</table>\n' +
'<center><span>' + ImagePrice + '</span></center>\n' +
'<table border="0" width="100%">\n' +
'<tr>\n' +
'<td width="50%" align="right"><a href="javascript:window.close()">Close Window</a></td>\n' +
'</tr>\n' +
'</table>\n' +
'</BODY>\n</HTML>\n';
msgWindow=window.open("","displayWindow",
"height=440,width=400,Toolbar=no,menubar=no")
msgWindow.document.open();
msgWindow.document.write(str);
msgWindow.document.close();
return;
}
#3
Scooby Regular
Thread Starter
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes
on
0 Posts
I actually have got that far, thanks very much anyway.
The problem I was running into was that inside my template file I was trying to run more functions that wrote text out.
I was having problems with the " and ' in my code and getting them into a string to document.write out...
The problem I was running into was that inside my template file I was trying to run more functions that wrote text out.
I was having problems with the " and ' in my code and getting them into a string to document.write out...
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM