Jump to content
The Uniform Server Community

Can't get Javascript to run in uniserver 5.6.5 or 5.6.6


myboycrais99
 Share

Recommended Posts

Hi,

 

I am new to forum posting but I will do my best :angry:

 

I have been running US 3.3 for a while but decided to finally upgrade to US 5.6. Currently, I have tried both US 5.6.5 and 5.6.6 on windows 7 x86 and my pages load fine, but all my old javascript code that worked in US 3.3 no longer loads! Can anyone help me?

 

Here is a basic code that I started with that used to work, but it no longer works (my apologies to the original author, I can't remember where I originally got this from, but it is a call to a basic javascript function [attached] that shows a countdown timer. Do I need to do something special with 5.6?

 

Thanks in advance for all your help!!

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

#cd {

margin: auto;

height: 50px;

width: 450px;

font-family: "Courier New", Courier, mono;

font-size: 24pt;

color: #000;

text-align: center;

font-weight: bold;

background-image: url(back.jpg);

vertical-align: middle;

}

-->

</style>

</head>

 

<body>

<h1 align="center">Counting Down to New Year's 2020</h1>

<p align="center">According to the time at Kuala Lumpur, Malaysia. </p>

<script language="JavaScript" SRC="countdown.php?timezone=Asia/Kuala_Lumpur&countto=2020-01-01 00:00:00&do=t&data=WAWASAN 2020"></SCRIPT>

<p> </p>

</body>

</html>

countdown.php

index.html

Link to comment
Share on other sites

Problem is with your php script. It is an old script that uses short tags

 

'' and '='

 

These should be replaced with their long form counterpart.

 

'<?php' and '<?php echo'

 

There is a quick way to test if this is the problem

By default Uniform Server has short tags disabled

You can enable short tags as follows:

 

Edit file UniServer\usr\local\php\php.ini

 

Change this line:

short_open_tag = Off

To:

short_open_tag = On

 

Please read the note above this line it explains you should not use short tags.

 

All the best

Ric :angry:

Link to comment
Share on other sites

Thanks Ric!!

 

That did the trick. I noticed that the original author was using short tags with "<?" and I fixed that but didn't realize that the equal sign in "<?=" needed to be replaced with an echo statement. Thanks again for all your help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...