#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    133
    Rep Power
    0

    code not running


    My JavaScript code is not working on WAMP but its working fine when I open it directly on Chrome ? Guide please... Code is:

    Code:
    <html>
    <head>
    	<script src="blabla.js"></script>
    	<title>AJAX Tutorial</title>
    </head>
    <body onload="gameTime()">
    
    	<div id="choice"></div>
    
    
    </body>
    </html>
    Code:
    function gameTime(){
    
    	alert("Hi !");
    
    	title = document.createTextNode("Some Stuff");
    	list = document.createElement("ul");
    
    	item1 = document.createElement("li");
    	text1 = document.createTextNode("PC Games");
    	item1.appendChild(text1);
    
    	item2 = document.createElement("li");
    	text2 = document.createTextNode("PC Mobo");
    	item2.appendChild(text2);
    
    	list.appendChild(item1);
    	list.appendChild(item2);
    
    	choice = document.getElementById("choice");
    	choice.appendChild(title);
    	choice.appendChild(list);
    
    	
    }
  2. #2
  3. Lord of the Dance
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Oct 2003
    Posts
    4,170
    Rep Power
    2011
    Even if you have it place local on in the WAMP system, you should be reading it within Chrome in both cases? or?
    Do you get any kind of error (messages)?

    If you press F12 in Chrome, you can try to debug and see what happens.
    https://developers.google.com/web/to...ls/javascript/
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Location
    India
    Posts
    2
    Rep Power
    0
    Press F12 then go to the Console window to see any JS errors which you are getting. This will help.

IMN logo majestic logo threadwatch logo seochat tools logo