Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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:

  • Author

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!

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...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.