Solved

Transferring a variable between html pages

Posted on 2000-04-25
15
170 Views
Last Modified: 2010-04-09
I am creating a product CD which is written in HTML.  There is a page where the users can click on the name of a AutoCAD drawing detail (out of about 2000 details to choose from) - [called the index page] and then the detail is displayed for them (courtesy of a plugin from AutoDesk called Volo View) - [called the display page].

My question is:  Is it possible to write only one display page and transfer the name of the file to display from the index page to the display page (thus avoiding writing about 2000 individual display pages which only vary in the filename to display)?

Please let me know if this is possible and include the source code if you can.

Thanks.
0
Comment
Question by:tmaga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 3

Expert Comment

by:y2kwacko
ID: 2748054
Check out http://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=10332674  - its still open and has a partial solution to your problem once you have that should be as easy as pie to finish.

Good Luck,
Kevin
0
 
LVL 1

Expert Comment

by:ManoloMA
ID: 2748069
You can save the name of the file in the index page:

<SCRIPT>
var sFile = "";
function file_name(cFile){
 sFile = cFile;
 }
</SCRIPT>

<A onclick="file_name('file.htm')" target="display" href="display.htm">file_name</a>


And in the display page get the name of the variable in the onload event:

<SCRIPT>
var sFile = "";
function window_onload(){
 window.alert(window.opener.sFile); //If it is other window
 window.alert (top.frames['index'].sFile); //If it is a frame
 }
</SCRIPT>

<BODY onload="window_onload()">


Manolo
0
 
LVL 1

Expert Comment

by:ManoloMA
ID: 2748075
Sorry, I wanted to make a comment
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:CJ_S
ID: 2748439
UHM, if they are like all images, you could try something like:

<html>
<body>
<script language=javascript>
<!--
   if(location.search)
      document.write("<img src=' + location.search + '><br>");

//-->
</script>

<a href='thispage.html?firstimage.jpg'>First Detail here</a>

</body>
</html>

Some explanation. The script'll take a look at the querystring (after the ? sign). If the querystring contains nothing, it won't show any image. If there IS something, then it'll write out the image (the part after ?). And after the image comes all the links again.
In the example, the page is called thispage.html. And the querystring is firstimage.jpg. If you open it first, then you won't see any image, but you will once you click on the link, cuz then there's something in the querystring.

Hope this does what you want.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2748443
little mistake there

document.write("<img src=' + location.search + '><br>");
should be
document.write("<img src='" + location.search + "'><br>");
0
 

Author Comment

by:tmaga
ID: 2786520
Sorry about the massive delay in responding, the day after I posted the question, I was unavoidably detained from using the computer.

I'm back and will see if the coding you have supplied will work and then (hopefully) award the points with no more delay.

Again, sorry for leaving this open for so long.
0
 

Author Comment

by:tmaga
ID: 2821807
This question has a deletion request Pending
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2822259
This question no longer is pending deletion
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2822260
..and why a deletion then?
0
 

Author Comment

by:tmaga
ID: 2822348
The company decided to elimate this type of indexing system on the CD.  I have no idea if what you had given me would even work.  

Do you want the Expert Points for your responses?  I have no problem with that, but first I will want to see if it works (can't give away something for nothing - even if it's only an academic challenge in the end).

I'll let you know my comments (as soon as I have any).  I hope that I didn't offend you (or ManoloMA for that matter) by attempting to delete the question.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2822377
tmaga, well I don't care about the points, but I just wanted to know the why of it. It'd be nice to have the points but not necessary.

And, to be honest, it sounds more than natural that if a question is answered you should at least evaluate the answers, that'd be appreciated.

Sorry for bothering you about that.

Regards,
CJ
0
 

Author Comment

by:tmaga
ID: 2822433
Definitely the considerate thing to do would be to provide feedback.  Sorry!  I know that... just under a little stress because now I've got to come up with the solution to the new way of doing things for the CD (the deadline hasn't changed...).

Best I can do is evaluate your proposed solution and give you feedback and the points.

No need to be sorry about informing me of my impoliteness.  Totally understandable and I would do the same thing in your place.

Best Regards,
Trevor
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 100 total points
ID: 2822470
I made one little mistake there though....it'll KEEP the ?-sign when doing it my way.

0
 

Author Comment

by:tmaga
ID: 2822556
Pardon?  I don't understand your last comment at all.
0
 

Author Comment

by:tmaga
ID: 2852053
Comment accepted as answer
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS style formatting? 2 37
CSS for <center> 14 35
Validating number not work with decimal 4 29
Calculating percentage 2 35
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question