Solved

HELP! Need popup to check link of parent page and display html based on that link

Posted on 2004-04-08
1
355 Views
Last Modified: 2012-05-04
Hello experts! As the title suggests I would like to make a popup that first checks the link of it’s parent.   Based on that link it then displays the picture for the popup, and also the wood options.  For better understanding of the latter, please view the following page and click on the thumb “stains”.

http://www.greenteadesign.com/newsite/reproductions/elmburl.html

As you can see the woods are limited to only burl.  However if you had gone to this page and clicked on the “stains thumb”…

http://www.greenteadesign.com/newsite/reproductions/4footmizuya.html

You would find that your options are Elm and Gingko.

Currently I am just linking to two separate pages.  I would rather not make a different page for each and every product, so I feel this mini-database would be the answer.  I would also like the page to be cached so the user need only load the list of variables once.

Here is the code of the current popup:
<html>
<head>
<title>Stains and Hardware</title>
<script>
function goto()
{
     self.resizeTo(document.images[0].width+15, document.images[0].height+132);
     self.moveTo(0,0);
}
</script>

<script>
function getSelectValue(selObject){
  return selObject.options[selObject.selectedIndex].value;
}
function chimg(){
  var d = document.forms[0];
  var w = getSelectValue(d.wood);
  var s = getSelectValue(d.stains);
  var h = getSelectValue(d.hardware);
  var elem = document.getElementById("help");
  if(getSelectValue(d.wood) && getSelectValue(d.stains) && getSelectValue(d.hardware)){
  //alert(wood);alert(stain);alert(hardware); //Debugging
  document.images["myimg"].src = "http://www.greenteadesign.com/images/custom/"+ w +"-"+ s +"-"+ h +".jpg";
  elem.innerHTML="<img name=myimg src=http://www.greenteadesign.com/images/custom/"+ w +"-"+ s +"-"+ h +".jpg>";
       return true;
  }else{
       alert("Please select all options!");
         return false;
  }
}//
</script>
</head>
<body onLoad=goto() bgcolor="#B6CAAE" style="margin-left: 0; margin-top: 0; margin-bottom: 0; margin-right: 0">
<div align=center valign=middle>
<div id=help><img name=myimg src="http://www.greenteadesign.com/images/custom/burl-gp-bh.jpg" alt=""><br></div>
<table border=0 cellspacing=cellpadding=0>
   <tr>
        <td width=478 height=2 bgcolor="#ffffff"><img src="http://www.greenteadesign.com/images/blank.gif" width=478 height=1><br></td>
   </tr>
   <tr>
        <td width=478 height=2 bgcolor="#647F5B"><img src="http://www.greenteadesign.com/images/darkgreen.gif" alt="" border=0 width=1 height=1><br></td>
   </tr>
</table>
<center>
<form name=imgform onsubmit="">

<SELECT NAME="wood">
      <OPTION VALUE="">- - - Select Wood - - -</OPTION>
      <OPTION VALUE="burl">Burl</OPTION>
     
</SELECT>

<SELECT NAME="stains">
      <OPTION VALUE="">- - - Select Stain - - -</OPTION>
      <OPTION VALUE="gp">Golden Pecan</OPTION>
      <OPTION VALUE="fw">Fruitwood</OPTION>
      <OPTION VALUE="ro">Red Oak</OPTION>
      <OPTION VALUE="mh">Mahogany</OPTION>
      <OPTION VALUE="ch">Chocolate</OPTION>
      <OPTION VALUE="wn">Walnut</OPTION>
</SELECT>

<SELECT NAME="hardware">
      <OPTION VALUE="">- - Select Handle - -</OPTION>
      <OPTION VALUE="bh">Brass Hirute</OPTION>
      <OPTION VALUE="ih">Iron Hirute</OPTION>
      <OPTION VALUE="bw">Brass Warabite</OPTION>
      <OPTION VALUE="iw">Iron Warabite</OPTION>
      <OPTION VALUE="ik">Iron Kakute</OPTION>
</SELECT>

<input type=button onClick="return chimg();" value="Go" style="color: #FFFFFF; background-color: #8B987C; border-width: 1; border-style: 1">
</form>

<div align=left><font size=+1>&nbsp<b> For more information on how to order this piece <a href="order.html" target=_blank>click here</a>.</b></font></div>
</center>

</div>
</body>
</html>


As always, your help is greatly appreciated,
Hayden

(P.S. Is there a better solution via php?)
0
Comment
Question by:Quarfelburg
1 Comment
 
LVL 12

Accepted Solution

by:
monosodiumg earned 250 total points
ID: 10788028
Not sure I see the problem. You can avoid multiple popups by resuing hte same window by giving the popup window a name and then looking for it.
If you can do server side stuff then you need only on php page which takes the type of furniture as an argument and generate the HTML as per your code but with the differnt sets of options. It's output is targeted (target attribute of link or URL arg in window.open) to the popup. You only create the popup window if none exists already (and, optionally, you close it when you go to a different page).

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

816 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now