Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by manecito

  1. This is the code we are using to set our Titles by passing two parameters from a previous page containing a DataPage with the fields in the URL. for example - http://www.eis-inc.com/suppliers/productdetail.asp?prod_nbr=620-3M&Catalog_Area=Tape%20Dispensers&SupCoName=3M%20EMD If anyone has some additional tweaks, let me know. We have to use the unescape() in a few places because our Catalog Area and Supplier Name fields contain "spaces", which the URL ends up adding the escape character %20 which then needs to be removed. <script> function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } var catalog_param = gup( 'Catalog_Area' ); var supplier_param = gup( 'SupCoName' ); var varCatalog = catalog_param; var varSupplier = supplier_param; document.title = unescape(varCatalog + ' Product List from EIS | ' + varSupplier); </script>
  2. We have a similar requirement. Only in addition to some URL's that are present on some items, not on others...We have a bunch of data that's been compiled over the years as the 'long description' on our items. The challenge is that some of the data was formatted by one person one way (with bold text one time, not another), then differently by another. In the example below, we have very basic html tags being used to give some line breaks so the text doesn't display as a wall of text and the link(s) will function...not display as you see below in this example. <p>Used in wet sanding, finest grade available for rough featheredging. 3M UPC # - 00051144020065 3M Internal # - 60070007061 [*]<a href=http://multimedia.mmm.com/mws/mediawebserver.dyn?bbbbbbL37nqbwFcbPFcbbb1IKneBBBB0->Enlarge Image</a> [b]3M(TM) Wetordry(TM) Tri-M-ite(TM) Sheet, 02006, 9 in x 11 in, 240A, 50 sheets per sleeve, 5 sleeves per case[/b] </p> Instead, it should look like this, when the HTML tags are properly displayed by the browser: Used in wet sanding, finest grade available for rough featheredging. 3M UPC # - 00051144020065 3M Internal # - 60070007061 Enlarge Image 3M Wetordry Tri-M-ite Sheet, 02006, 9 in x 11 in, 240A, 50 sheets per sleeve, 5 sleeves per case
  3. Thanks to the earlier responses I was able to accomplish our requirements. I have modified it to give totals under two columns. I also added some extra formatting code to help make this display a bit more aesthetically pleasing, but the CSS may be subject to change depending on your situation. I had issues with the original regExp parameters, but found that this worked for our needs. <script type="text/javascript"> var regExp = /\$|\,/gi; function ReplaceTags(xStr){ xStr = xStr.replace(regExp,""); return xStr; } <!-- Begin formatting for to display results as $ currency function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num + '.' + cents); } // End currency formatting--> var mytable=document.getElementsByTagName("table")[0]; var myrow=mytable.getElementsByTagName("tr"); var i; //Change the salesCol and gpCol numbers accordingly var salesCol=2; var gpCol=3; var salesTotal=0; var gpTotal=0; rowlength=myrow.length; for (i=1; i<rowlength; i++) { var mycel =myrow[i].getElementsByTagName("td"); var textNum1 = ReplaceTags(mycel[salesCol].innerHTML); var num1 = parseFloat(textNum1); var textNum2 = ReplaceTags(mycel[gpCol].innerHTML); var num2 = parseFloat(textNum2); salesTotal = salesTotal + num1; gpTotal = gpTotal + num2; } document.getElementsByTagName('table')[0].insertRow(rowlength); var a=document.getElementsByTagName('table')[0].rows[rowlength]; a.insertCell(0); //Label for the sum var z=a.insertCell(1); z.innerHTML="<div align=right class='cbResultSetTableCell cbResultSetData'>[b]Total:[/b]</div>"; //Insert a cell in columns two & three and display the totals. var y=a.insertCell(2); y.innerHTML="<div class='cbResultSetTableCell cbResultSetData'>[b]"+formatCurrency(salesTotal)+"[/b]</div>"; var y=a.insertCell(3); y.innerHTML="<div class='cbResultSetTableCell cbResultSetData'>[b]"+formatCurrency(gpTotal)+"[/b]</div>"; //Insert the rest of the cells a.insertCell(4); a.insertCell(5); </script>
  • Create New...