How can I preview JS? - Post ID 218718

User 122279 Photo


Senior Advisor
14,610 posts
Online Now

A new line to write on your chalkboard, Matt: container... container...container :P
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 1948478 Photo


Senior Advisor
1,850 posts

UncleMap wrote:
Ok then I need to get a new browser :).. i'm linking my sources correctly as far as I know, and have just one string which is hello world, and when I go to preview it in CC Html or anything else I get a grey screen. Google Chrome must not support pop up javascript then?

Per wrote:
The problem is not the browser, nor is it the HTML Editor!

Take a look at this screenshot from the Editor and corresponding Chrome preview...
Attachments:
User 2924428 Photo


Registered User
1,718 posts

Ok thanks guys, i'm going to make some changes and then see what happens.
User 474778 Photo


Registered User
215 posts

@UncleMap, Google WampServer and XAMPP. Either would allow you to host your own local Web server, right on your own PC, at no charge. You can view the results of your Javascript and PHP coding privately, without the public exposure and cost of using a remote Web hosting service.

Once you have your site just the way you want it, you can upload it to a hosting service.

IMHO, WampServer is better if you use Windows exclusively. Go with XAMPP if you want to use the same system on both Windows and Linux.
halfnium -AT- alum.mit.edu
Yes, I looked just like that in 1962.
User 2924428 Photo


Registered User
1,718 posts

Hello Halfnium, thank you so much for recommending the server to me, i'm using it but i've run into a bit of a problem. I'm trying to upload a script to test the browser API capabilities and it doesn't seem to want to register. Here is the code below, i'm working out of the www folder and have it saved as window.js ,
// window object

// show message
function ShowMessage(msg) {
document.getElementById("message").innerHTML += "<p>"+msg+"</p>";
}

ShowMessage("window.name: "+window.name);
ShowMessage("window.innerWidth: "+window.innerWidth);
ShowMessage("window.innerHeight: "+window.innerHeight);
ShowMessage("window.outerWidth: "+window.outerWidth);
ShowMessage("window.outerHeight: "+window.outerHeight);
ShowMessage("window.screenX: "+window.screenX);
ShowMessage("window.screenY: "+window.screenY);

window.scrollTo(0, 100);
ShowMessage("window.pageXOffset: "+window.pageXOffset);
ShowMessage("window.pageYOffset: "+window.pageYOffset);

var n = window.prompt("What is your name?");
ShowMessage("Hello "+n);

// print dialog
// window.print();

// open a new window
var win = window.open("", "newwin", "width=300,height=300,menubar=0,toolbar=0,resizable=0,screenX=2000,screenY=200");

win.document.body.innerHTML = "<p>Hello World!</p>";


Any help to get this preview to work would be greatly appreciated as well.. thanks Halfnium!
User 2924428 Photo


Registered User
1,718 posts

Google for the win!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.