Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Javascript


Guest

Recommended Posts

Please could anyone advise me how, (and where) I add the following javascript text to a php page.

 

<script type="text/javascript">

function displaydesc(which, descriptionarray, container){

if (document.getElementById)

document.getElementById(container).innerHTML=descriptionarray[which.selectedInde

x]

}

 

function jumptolink(what){

var selectedopt=what.options[what.selectedIndex]

if (document.getElementById && selectedopt.getAttribute("target")=="newwin")

window.open(selectedopt.value)

else

window.location=selectedopt.value

}

 

 

displaydesc(document.form1.select1, thetext1, 'textcontainer1')

displaydesc(document.form2.select2, thetext2, 'textcontainer2')

 

</script>

This is the page I am wanting top add the text to.

 

<?php

/*

$Id: msds.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Safety Data Sheets');

define('HEADING_TITLE', 'Materials Safety Data Sheets');

 

define('TEXT_INFORMATION', 'Select the required product from the list below and

click<br><b> Open MSDS to view printable version.</b>

 

 

</td>

</tr>

<tr>

<form name="form1">

<td class="main" width="180" valign="top" align="left"><p>

 </p>

<p>

<select name="select1" size="20">

<option value="http://www.janitorman.net/PD022%20Granulite%20print.pdf" target="newwin">CAT035       

Granular Salt</option>

<option value="http://www.janitorman.net/msd%20sheets/PD006%20Aquasol%20print.pdf" target="newwin">CAT036       

Tablet Salt</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT019.pink%20sanitising%20powder.pdf">CAT019       

Pink Sanitising Powder</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT028-std-strength-washing-up-liquid.pdf">CAT028       

Washing Up Liquid</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT039-40-machine%26glass-rinse-aid.pdf">CAT039/40   

Rinse Aid</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT048%20Advance%20Dishwash%20Powder.pdf">CAT048       

Advance Dishwash Powder</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT049Advance-Dishwash%20tablet.pdf">CAT049       

Advance Dishwash Tablet</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT059-60%20auto-dishwash-detergent.pdf">CAT059/60  

Advance Dishwash Detergent</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT068.oven%20cleaner.pdf">CAT068       

Oven Cleaner</option>

<option value="http://www.janitorman.net/msd%20sheets/CAT093-95.cleaner.sanitiser.pdf">CAT093/95  

Cleaner-Sanitiser</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU012-MRSA%20Hard%20Surface%20Cleaner.pdf">HOU012       

MRSA Hard Surface Cleaner</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU024.lemon%20floor%20gel.pdf">HOU024       

Lemon Floor Gel</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU047.pine.pdf">HOU047       

Pine Disinfectant</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU062-64-washroom%20cleaner.pdf">HOU062/64  

Washroom Cleaner</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU095-6bactericidal-cleaner-trigger-5litre.pdf">HOU095       

Bacetericidal Cleaner Trigger Spray</option>

<option value="http://www.janitorman.net/msd%20sheets/HOU109.hard%20surface%20cleaner%20degreaser.pdf">HOU109       

Concentrated Degreaser Cleaner</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU005-non-bio-laundry%20powder.pdf">LAU005        

Laundry Powder - Non Bio</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU007-bio%20laundry%20powder.pdf">LAU007        

Laundry Powder - Bio</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU014-034-040Destainer.pdf">LAU014/34   

Laundry Destainer</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU051-non-bio-laundry%20tablet.pdf">LAU051        

Laundry Tablet - Non Bio</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU060-1MRSA%20Laundry%20liquid.pdf">LAU060/61   

MRSA Laundry Liquid</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU063-1MRSA%20LaundryPowder.pdf">LAU061/3     

MRSA Laundry Powder</option>

<option value="http://www.janitorman.net/msd%20sheets/LAU064-5-1MRSA%20Fabric%20Conditioner.pdf">LAU064/5     

MRSA Fabric Conditioner</option>

</select></p>

<p>

<input type="button" onClick="jumptolink(document.form1.select1)" width="150" height="25" value=" Open MSDS ">

 

 

 

 

 

 

 

</p> </td><td class="main" width="234" valign="top" align="left">  

<p> </p>

<p> </p>

<p> <img border="0" src="http://www.janitorman.net/images/msds_ubik.gif" align="right" width="211" height="222"> </p>

</td>

</tr>

<tr>

<td colspan="3" width="670"><height="30"></td>

</tr>

<p align="left"><font face="Arial"><a href="http://www.adobe.co.uk/products/acrobat/readstep.html"><img border="0" src="http://www.janitorman.net/images/get_reader.gif" width="88" height="31" align="left"></a> 

</font><font face="Arial" size="1">To view and print our MSDS

Sheets you will need to have Abobe Acrobat Reader installed onto

your

system.             </font></p>

<p align="left"><font face="Arial" size="1">To download Adobe Acrobat Reader, please click on

the Get Adobe Acrobat Reader icon.</font></p>

<p> </p>

</td>

</tr>

 

 

');

 

?>

 

If anyone can offer any advice, I would greatly appreciate it.

The script is required to make the search function work.

Link to comment
Share on other sites

It can be placed before the first define statement (be sure to proceed it with ?> and follow it with <?php), but it should be placed in the <head> section of the root file (msds.php). Actually, it should be made into an external file and loaded in the <head> section. But any of those will work.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack

 

Thanks again for your help.

I placed it in the original php document, preceeded with the >php and proceeded by <?php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...