Solved

Transferring a variable between html pages

Posted on 2000-04-25
15
172 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
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 
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 WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

617 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