Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Transferring a variable between html pages

Posted on 2000-04-25
15
Medium Priority
?
174 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

927 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