Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31

Thread: Repair Script

  1. #11
    Join Date
    Oct 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not working

    It is still not working. I appreciate your help.
    Here is a link https://www.nationalhomestore.com/ste_heightcalculator


    Code:
    <style type="text/css">
    
    #hintbox{ /*CSS for pop up hint box */
    position:absolute;
    top: 0;
    background-color: lightgrey;
    width: 150px; /*Default width of hint.*/ 
    padding: 3px;
    border:1px solid black;
    font:normal 12px Arial;
    line-height:18px;
    z-index:100;
    border-right: 3px solid black;
    border-bottom: 3px solid black;
    visibility: hidden;
    }
    
    .hintanchor{ /*CSS for link that shows hint onmouseover*/
    font-weight: bold;
    color: navy;
    margin: 3px 8px;
    }
    
    </style>
    
    <script type="text/javascript">
    
    /***********************************************
    * Show Hint script- � Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    ***********************************************/
    		
    var horizontal_offset="9px" //horizontal offset of hint box from anchor link
    
    /////No further editting needed
    
    var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
    var ie=document.all
    var ns6=document.getElementById&&!document.all
    
    function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function clearbrowseredge(obj, whichedge){
    var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
    if (whichedge=="rightedge"){
    var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
    dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
    }
    else{
    var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
    dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
    }
    return edgeoffset
    }
    
    function showhint(menucontents, obj, e, tipwidth){
    if ((ie||ns6) && document.getElementById("hintbox")){
    dropmenuobj=document.getElementById("hintbox")
    dropmenuobj.innerHTML=menucontents
    dropmenuobj.style.left=dropmenuobj.style.top=-500
    if (tipwidth!=""){
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=tipwidth
    }
    dropmenuobj.x=getposOffset(obj, "left")
    dropmenuobj.y=getposOffset(obj, "top")
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
    dropmenuobj.style.visibility="visible"
    obj.onmouseout=hidetip
    }
    }
    
    function hidetip(e){
    dropmenuobj.style.visibility="hidden"
    dropmenuobj.style.left="-500px"
    }
    
    function createhintbox(){
    var divblock=document.createElement("div")
    divblock.setAttribute("id", "hintbox")
    document.body.appendChild(divblock)
    }
    
    if (window.addEventListener)
    window.addEventListener("load", createhintbox, false)
    else if (window.attachEvent)
    window.attachEvent("onload", createhintbox)
    else if (document.getElementById)
    window.onload=createhintbox
    
    </script>
    
    
    
    
    
    <script language="JavaScript">
    <!-- Begin
    function calc_headroom(form) {
    var mattress = form.mattress.value;
    var ceiling = form.ceiling.value;
    var above = form.above.value;
    var leg691 = 0
    var leg692 = 0
    var leg831 = 0
    var leg832 = 0
    var trim691 = 0
    var trim692 = 0
    var trim831 = 0
    var trim832 = 0
    var underceiling = (ceiling - above - mattress - 3);
    
    form.under691.value = (69 - 5 - mattress - 3);
    if (underceiling < form.under691.value) (form.under691.value = underceiling);
    form.under831.value = (83 - 5 - mattress - 3);
    if (underceiling < form.under831.value) (form.under831.value = underceiling);
    form.under692.value = (69 - 10 - mattress - 3);
    if (underceiling < form.under692.value) (form.under692.value = underceiling);
    form.under832.value = (83 - 10 - mattress - 3);
    if (underceiling < form.under832.value) (form.under832.value = underceiling);
    
    form.a691.value = (ceiling - mattress - 3 - form.under691.value);
    form.a831.value = (ceiling - mattress - 3 - form.under831.value);
    form.a692.value = (ceiling - mattress - 3 - form.under692.value);
    form.a832.value = (ceiling - mattress - 3 - form.under832.value);
    
    leg691 = -(-3 - mattress - 5 - form.under691.value);
    leg831 = -(-3 - mattress - 5 - form.under831.value);
    leg692 = -(-3 - mattress - 10 - form.under692.value);
    leg832 = -(-3 - mattress - 10 - form.under832.value);
    
    trim691 = 69 - leg691;
    trim831 = 83 - leg831;
    trim692 = 69 - leg692;
    trim832 = 83 - leg832;
    
    form.top691.value = leg691 - 5;
    form.top831.value = leg831 - 5;
    form.top692.value = leg692 - 10;
    form.top832.value = leg832 - 10;
    
    minabove30 = "Suggestion: We recommend the Minimum Headroom Above the Mattress is 30 inches.";
    mattresszero = "Error: The Mattress Thickness must be greater than zero";
    mattress40 = "Error: The Mattress Thickness must be less than 40 inches";
    
    if (mattress < 1) alert(mattresszero);  // mattress must be greater than zero
    if (mattress > 40) alert(mattress40); // mattress can't be greater then 40
    if (above < 10) alert(minabove30);  // minimum headroom above is 30
    
    }
    //  End -->
    </script>
    
    <center>
    <form method="POST" id="calcform">
    
    
    <table bgcolor="#ffffff" width="550" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td><h2>Height Calculator</h2>
      <h4>How much headroom will I get?<br />
        Enter your specifications below and then press Calculate Headroom. </h4></td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
    <td valign="top">
      <div>
    <table width="85%" align="center" cellpadding="2" cellspacing="2">
      <tr>
        <td width="74%">Total Mattress Thickness <a href="#" class="hintanchor" onMouseOver="showhint('Enter the total thickness of the mattress and any mattress topper.', this, event, '200px')" style="text-decoration: none; vertical-align: middle; font-weight: 400;color:#900">[?]</a></td>
        <td width="26%"><input name="mattress" size="3" value="8" onFocus="select()" maxlength="2"> inches</td>
      </tr>
      <tr>
        <td>Ceiling Height <a href="#" class="hintanchor" onMouseOver="showhint('We need the ceiling height to calculate how much headroom you will get above and underneath.', this, event, '200px')" style="text-decoration: none; vertical-align: middle; font-weight: 400;;color:#900">[?]</a></td>
        <td><input name="ceiling" size="3" value="96" onFocus="select()"> inches</td>
      </tr>
      <tr>
        <td>Minimum Headroom Above Mattress <a href="#" class="hintanchor" onMouseOver="showhint('We recommend a minimum of 30 inches of headroom above.', this, event, '200px')" style="text-decoration: none; vertical-align: middle; font-weight: 400;;color:#900">[?]</a></td>
        <td><input name="above" size="3" value="30" onFocus="select()"> inches</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
    <td colspan="2" align="right"><input value="Reset" type="reset" onclick="setTimeout(function(){calc_headroom(document.getElementById('calcform'));}, 100); return true;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input value="Calculate Headroom" onClick="calc_headroom(this.form)" type="button"></td>
        </tr>
    </table><br /> <br /> 
    
    <h2><strong><center>Headroom Above &amp; Underneath the Mattress</center></strong></h2><br />
    
    <table width="75%" align="center" cellpadding="2" cellspacing="2">
      <tr>
        <td colspan="2"><strong>Using Single Or Double Safety Rail</strong></td>
        </tr>
      <tr>
        <td><strong>69" Legs</strong></td>
        <td><strong>83" Legs</strong></td>
      </tr>
      <tr>
        <td>Above &nbsp;<input name="a691" value="32" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
        <td>Above &nbsp;<input name="a831" value="18" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
      </tr>
      <tr>
        <td>Underneath&nbsp;<input name="under691" value="53" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
        <td>Underneath&nbsp;<input name="under831" value="67" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
      </tr>
      <tr>
        <td>Top of Mattress&nbsp;<input name="top691" value="64" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
        <td>Top of Mattress&nbsp;<input name="top831" value="78" size="3" style="color: rgb(255, 0, 0); font-weight: bold;"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    
      <tr>
    <td colspan="2" align="center"><input value="Return to Previous Page" onClick="javascript:history.back()" type="button"></td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table>
    
    <center>
      <p><img src="media/cms/html/loft_drawing_text.gif" width="485" border="0" height="339"></p>
      <table width="100%" cellspacing="2" cellpadding="2">
        <tr>
          <td height="33%" align="center" valign="top"><h6>Standard 69" Legs<br />Single Safety Rail<br /><img src="media/cms/html/loft_clear_100x97.jpg" width="100" height="97" alt="Standard 69&quot; Legs with Single Safetry Rail"></h6></td>
          <td height="33%" align="center" valign="top"><h6>Extra Tall 83" Legs<br />Single Safety Rail<br /><img src="media/cms/html/loft_extratall_100x111.jpg" width="100" height="111" alt="Extra Tall 83&quot; Legs with Single Safety Rail"></h6></td>
          <td width="33%" align="center" valign="top"><h6>Standard 69" Legs<br />Youth (Double) Safety Rails<br /><img src="media/cms/html/youth_sdc_1468x1480_small1.jpg" width="100" height="100" alt="Standard 69&quot; Legs with Youth (Double) Safety Rails"></h6></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </center>
          
          
         </div></td>
    </tr>
    </tbody></table>
    </td>
    </tr>
    </tbody></table>
    
    </form></center>
    <script>
    calc_headroom(document.getElementById('calcform'));
    </script>
    Last edited by jscheuer1; 10-18-2017 at 04:31 PM. Reason: format

  2. #12
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    It was working fine for me. You changed something else. You removed elements from the form, and now the script is throwing an error when it looks for them. You should either put them back or we will need to remove them from the script. Also, this part has nothing to do with it:

    Code:
    <style type="text/css">
    
    #hintbox{ /*CSS for pop up hint box */
    position:absolute;
    top: 0;
    background-color: lightgrey;
    width: 150px; /*Default width of hint.*/ 
    padding: 3px;
    border:1px solid black;
    font:normal 12px Arial;
    line-height:18px;
    z-index:100;
    border-right: 3px solid black;
    border-bottom: 3px solid black;
    visibility: hidden;
    }
    
    .hintanchor{ /*CSS for link that shows hint onmouseover*/
    font-weight: bold;
    color: navy;
    margin: 3px 8px;
    }
    
    </style>
    
    <script type="text/javascript">
    
    /***********************************************
    * Show Hint script- � Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    ***********************************************/
    
    var horizontal_offset="9px" //horizontal offset of hint box from anchor link
    
    /////No further editting needed
    
    var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
    var ie=document.all
    var ns6=document.getElementById&&!document.all
    
    function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function clearbrowseredge(obj, whichedge){
    var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
    if (whichedge=="rightedge"){
    var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
    dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
    }
    else{
    var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
    dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
    }
    return edgeoffset
    }
    
    function showhint(menucontents, obj, e, tipwidth){
    if ((ie||ns6) && document.getElementById("hintbox")){
    dropmenuobj=document.getElementById("hintbox")
    dropmenuobj.innerHTML=menucontents
    dropmenuobj.style.left=dropmenuobj.style.top=-500
    if (tipwidth!=""){
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=tipwidth
    }
    dropmenuobj.x=getposOffset(obj, "left")
    dropmenuobj.y=getposOffset(obj, "top")
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
    dropmenuobj.style.visibility="visible"
    obj.onmouseout=hidetip
    }
    }
    
    function hidetip(e){
    dropmenuobj.style.visibility="hidden"
    dropmenuobj.style.left="-500px"
    }
    
    function createhintbox(){
    var divblock=document.createElement("div")
    divblock.setAttribute("id", "hintbox")
    document.body.appendChild(divblock)
    }
    
    if (window.addEventListener)
    window.addEventListener("load", createhintbox, false)
    else if (window.attachEvent)
    window.attachEvent("onload", createhintbox)
    else if (document.getElementById)
    window.onload=createhintbox
    
    </script>
    That part is a hint script and is working fine. When you hover over the [?] symbols, it gives you hints. The other part here:

    Code:
    <script language="JavaScript">
    <!-- Begin
    function calc_headroom(form) {
    var mattress = form.mattress.value;
    var ceiling = form.ceiling.value;
    var above = form.above.value;
    var leg691 = 0
    var leg692 = 0
    var leg831 = 0
    var leg832 = 0
    var trim691 = 0
    var trim692 = 0
    var trim831 = 0
    var trim832 = 0
    var underceiling = (ceiling - above - mattress - 3);
    
    form.under691.value = (69 - 5 - mattress - 3);
    if (underceiling < form.under691.value) (form.under691.value = underceiling);
    form.under831.value = (83 - 5 - mattress - 3);
    if (underceiling < form.under831.value) (form.under831.value = underceiling);
    form.under692.value = (69 - 10 - mattress - 3);
    if (underceiling < form.under692.value) (form.under692.value = underceiling);
    form.under832.value = (83 - 10 - mattress - 3);
    if (underceiling < form.under832.value) (form.under832.value = underceiling);
    
    form.a691.value = (ceiling - mattress - 3 - form.under691.value);
    form.a831.value = (ceiling - mattress - 3 - form.under831.value);
    form.a692.value = (ceiling - mattress - 3 - form.under692.value);
    form.a832.value = (ceiling - mattress - 3 - form.under832.value);
    
    leg691 = -(-3 - mattress - 5 - form.under691.value);
    leg831 = -(-3 - mattress - 5 - form.under831.value);
    leg692 = -(-3 - mattress - 10 - form.under692.value);
    leg832 = -(-3 - mattress - 10 - form.under832.value);
    
    trim691 = 69 - leg691;
    trim831 = 83 - leg831;
    trim692 = 69 - leg692;
    trim832 = 83 - leg832;
    
    form.top691.value = leg691 - 5;
    form.top831.value = leg831 - 5;
    form.top692.value = leg692 - 10;
    form.top832.value = leg832 - 10;
    
    minabove30 = "Suggestion: We recommend the Minimum Headroom Above the Mattress is 30 inches.";
    mattresszero = "Error: The Mattress Thickness must be greater than zero";
    mattress40 = "Error: The Mattress Thickness must be less than 40 inches";
    
    if (mattress < 1) alert(mattresszero); // mattress must be greater than zero
    if (mattress > 40) alert(mattress40); // mattress can't be greater then 40
    if (above < 10) alert(minabove30); // minimum headroom above is 30
    
    }
    // End -->
    </script>
    Is the only javascript which deals with calculating. That and the form are all that's involved. None of it's from Dynamic Drive.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #13
    Join Date
    Oct 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Script

    Can I pay to make a script do what I want it to do based on this page?

    https://www.nationalhomestore.com/ste_heightcalculator
    Last edited by jscheuer1; 10-19-2017 at 12:01 AM. Reason: format

  4. #14
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Sure. But again, I don't think you really need to. I probably should have noted before that I don't like having to hit a moving target. If that's how you want the page, I can get it working. If it's not, please make sure the page is as you want it before asking for further help.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #15
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by jscheuer1 View Post
    Sure. But again, I don't think you really need to. I probably should have noted before that I don't like having to hit a moving target. If that's how you want the page, I can get it working. If it's not, please make sure the page is as you want it before asking for further help.
    Something else occurred to me about this situation. Since we already had it working, then you removed form elements which then broke it again, you could just put those back and it would work. If you don't want those shown, you can just set them to display none. That way, if you ever wanted to bring them back, you could, and it wouldn't break the script. You could also remove others and bring these back, or a combination. A much better idea than having to fix the script every time you change the form. If you need help on making your form elements display none, just let me know.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #16
    Join Date
    Oct 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,
    I just put back the original script with your changes and it does not calculated correctly in all the fields. It need to change the bottom part by the same amount that is entered above. For example, if you increase the mattress thickness by 2" you decrease the clearance height and under bed clearance by the same amount.

    https://www.nationalhomestore.com/ste_heightcalculator
    Last edited by jscheuer1; 10-19-2017 at 07:29 PM. Reason: format

  7. #17
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    OK, I'm not sure what you mean. I agree that if you change a value in the top part, it doesn't automatically change the values in the bottom part. However, if after you change a value in the top part, you hit the "Calculate Headroom" button, then the values in the bottom do change in a way that makes sense to me. So, either you want them to change immediately, or you want them to change in a different way, or both (any or all of which can be arranged, if I only know for certain what you are after). Can you be more specific about exactly what you wish to see happen?

    On the other hand, if you are not seeing any changes in the bottom part after changes in the top part and hitting the "Calculate Headroom" button, then perhaps you need to clear the cache and/or refresh the page. And if after that you're still not seeing any changes in the bottom part, let me know which browser and which version of that browser you are using because in any modern browser, it should be working at least as I'm seeing it.

    That said, again, if it is working like I say I'm seeing when you test it, but that's still not what you want, please be more specific about the result you desire.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #18
    Join Date
    Oct 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    All it needs to do is change the bottom values by the same amount as it is changed on top. For example, if you increase the ceiling height by 2" so should the value on the bottom be increased by 2". If you increase the tickness of the mattress by 2" then the clearance on the bottom is reduced by 2". I hope this helps.

  9. #19
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    As far as I can tell that's what happens. For example, if I increase mattress size from 8 to 10 and then click "Calculate Headroom", the "Underneath" values in all four lower sections decrease by 2. You really need to be more specific about what the problems is, if in fact there really is one.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #20
    Join Date
    Oct 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any way I can get a script to work the way I want it to?

Similar Threads

  1. JavaScript work repair and update needed -- URGENTLY
    By jaynoble in forum General Paid Work Requests
    Replies: 2
    Last Post: 08-21-2009, 03:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •