Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Java Script Problems


Guest

Recommended Posts

I have a Java Script I would like to insert but isn't appearing. The same code works when embedded in a straight html page

simple line of code

<td colspan="2"><br> <script type="text/javascript" language="JavaScript1.2" src="24hi.js"></script></td>

 

What could be my issue. I'm wondering if it is where I put the script is an issue. Generally its in the same folder as the html page.

Thanks for any help. This is my first customization of a page

Link to comment
Share on other sites

make sure the js file is declared inside the header, for example:

 

<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>

 

then you should be able to use its functions inside the html body.

Link to comment
Share on other sites

make sure the js file is declared inside the header, for example:

 

<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>

 

then you should be able to use its functions inside the html body.

I've done that. What level should the java script be in? I've been placing it in the catalog folder.

Link to comment
Share on other sites

yes in the catalog folder between the <head> tags should be the js file. I saw it initially you had it inside the body html. Then you simply call the js functions. See how the checkout_shipping or checkout_payment.php files do it.

Link to comment
Share on other sites

yes in the catalog folder between the <head> tags should be the js file. I saw it initially you had it inside the body html. Then you simply call the js functions. See how the checkout_shipping or checkout_payment.php files do it.

 

 

Thanks I have it working now. The joy of first time with a new project. I can't wait till my 2nd site.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...