SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS not worked on new host

    Gudday all
    Recently I was forced to change hosts for my wife's on-line business.
    On the previous host my JS for displaying date last modified worked ok. But on the new host it is not visible.
    The new host calims that my code must be wrong but I do not see how as it is unchanged.
    Before is the code
    Code:
    <script type="text/javascript">//<![CDATA[var now =  new Date();document.write('<p class="webmaster">');document.write("Site design &copy; Petals &amp; Patches 2004 -" + now.getFullYear() + ".");document.write('<p class="lastupdated">');document.write("Last updated on " + document.lastModified.substring(3,5) + "/" + document.lastModified.substring(0,2)+ "/" + document.lastModified.substring(6,10) + '<\/p>');//]]></script>
    Is there any thing wrong with the code that might prevent it from working or displaying? Or is there some setting on the new host that needs to be changed? Or is the hoster is playing hard to get?

    What I also find very puzzling is that on taht same page I have JS to detect whether a radio button has been selected or not and it workd fine.
    This code is below
    Code:
    <script language="javascript" type="text/javascript">function checkRadio (frmName, rbGroupName){  var radios = document[frmName].elements[rbGroupName];   for (var i=0; i<radios.length;i++)    {	 if (radios[i].checked) {	  return true;	  }	}	return false;  }function valFrm(frmName){ if (!checkRadio(frmName, "productpr")) {  var err = 'You have not selected a ' + frmName  + ' quilt option. Please select an option';  alert(err);  return false; } else   return true;} </script>
    ========================
    Carn the Tiges!
    www.petalsandpatches.com

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That will generate a P tag within a P tag (and one of them won't be closed). That's not allowed.

    It is horrible code anyway. For a start, you should do this stuff on the server, you don't need javascript for it. Also, document.write should not be used at all.

    Or is the hoster is playing hard to get?
    This doesn't make sense, as all that should run on the browser and is unrelated to the host.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •