Solved

Transferring a variable between html pages

Posted on 2000-04-25
15
168 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

809 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