Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Javascript question

Thread Tools
 
Search this Thread
 
Old Jul 18, 2002 | 11:02 AM
  #1  
RichB's Avatar
RichB
Thread Starter
Scooby Regular
 
Joined: Apr 1999
Posts: 3,666
Likes: 0
From: Bore Knee Muff
Question

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
Reply
Old Jul 18, 2002 | 12:20 PM
  #2  
Gazza_W1's Avatar
Gazza_W1
Scooby Regular
 
Joined: Jun 2002
Posts: 55
Likes: 0
Post

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;
}
Reply
Old Jul 18, 2002 | 12:35 PM
  #3  
RichB's Avatar
RichB
Thread Starter
Scooby Regular
 
Joined: Apr 1999
Posts: 3,666
Likes: 0
From: Bore Knee Muff
Post

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...
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
Nov 4, 2021 07:12 PM
slimwiltaz
General Technical
20
Oct 9, 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
Oct 6, 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
Oct 2, 2015 05:26 PM
the shreksta
Other Marques
26
Oct 1, 2015 02:30 PM




All times are GMT +1. The time now is 10:27 AM.