PDA

View Full Version : Script Tester Script



[Nicolas]
02-07-2012, 07:00 PM
1) CODE TITLE: Script Tester Script

2) AUTHOR NAME/NOTES: Nicolas Wallace (Thanks to Keyboard13333 for noting a few errors)

3) DESCRIPTION: This is a script that you can use to test out a script that you made w/o making more HTML pages on your computer, could also be used as a website creator by giving it the power to make web pages. I have made a few scripts before, including this one. I made this kind of script at one point but it got deleted from my computer, so I rebuilt it. It is a 3kb HTML file. And it's only an HTML file.
What code you can test with it:
Ajax, HTML, Javascript, CSS, JQuery, and any other type of code your computer supports.
I might eventually make a PHP code tester.
I hope you like it, and I hope it gets added to Dynamic Drive :D

4) URL TO CODE: http://daba.medianewsonline.com/scripts/sc1.html

Edit: Sorry, the link broke.
I attached a few html inside a zip file.
I hope you enjoy, I lost the script twice and have rebuilt it again.

djr33
02-08-2012, 05:22 AM
The link you posted is broken, so I can't check it out.

There are already a number of these around the internet, but having one on DD wouldn't hurt. The only problem is that we don't usually want these on our sites-- we want them for building our sites. But in some cases it may help.



I might eventually make a PHP code tester.This is a dangerous idea. Allowing users to test code on their own computers is fine. But with a serverside language like PHP, that code will be executing on your server. At best, you'll have occasional errors with endless loops that might crash your server, and at worst you'll get hacked. In fact, either you will need to limit PHP's functions to a point where they would not be useful or you would have security holes. And only a true expert should attempt that, although honestly it wouldn't be that useful anyway, once many functions were taken out.

[Nicolas]
02-08-2012, 06:01 PM
The link you posted is broken, so I can't check it out.

There are already a number of these around the internet, but having one on DD wouldn't hurt. The only problem is that we don't usually want these on our sites-- we want them for building our sites. But in some cases it may help.


This is a dangerous idea. Allowing users to test code on their own computers is fine. But with a serverside language like PHP, that code will be executing on your server. At best, you'll have occasional errors with endless loops that might crash your server, and at worst you'll get hacked. In fact, either you will need to limit PHP's functions to a point where they would not be useful or you would have security holes. And only a true expert should attempt that, although honestly it wouldn't be that useful anyway, once many functions were taken out.

I know there are a few online, but there aren't as many made out of just Javascript.
As for the PHP quote, I must pay attention. I may not do anything like that, or if I do, I will put it on a server I do not need. I could get another.
I attached a TXT file that has the code, and I don't know why the link broke. It keeps having problems.
Hope you enjoy.

jscheuer1
02-09-2012, 05:22 AM
The link you posted is broken, so I can't check it out.

djr33
02-09-2012, 07:06 AM
Hmm, well, it seems to work, but there are two problems:
1. It reloads the page, causing all of the text we just entered to go away. Although in some browsers the "back" button can help us to go back and retrieve that text, that won't always work. This is very inconvenient. Many editors like this use iframes so the preview and code are independent. I think that's important.
2. You have at least one syntax error (I didn't notice any others)-- in JS, comments are marked by //comment, not like HTML <!--comments-->. So within the JS block, you need to use JS comments, rather than the HTML comment that you have now.

[Nicolas]
02-09-2012, 05:34 PM
Hmm, well, it seems to work, but there are two problems:
1. It reloads the page, causing all of the text we just entered to go away. Although in some browsers the "back" button can help us to go back and retrieve that text, that won't always work. This is very inconvenient. Many editors like this use iframes so the preview and code are independent. I think that's important.
2. You have at least one syntax error (I didn't notice any others)-- in JS, comments are marked by //comment, not like HTML <!--comments-->. So within the JS block, you need to use JS comments, rather than the HTML comment that you have now.

I knew I messed that up :P
Thank you for corrections.
And I had it in an iFrame on the page, but for some reason Medianewsonline deleted it.
If you want to add an iframe, I would recommend doing iframeBorder="0" scrolling="no" to an iframe.

<iframe src="wpt1.html" iframeBorder="0" scrolling="no" style="height: --px; width: --px;">Your browser doesn't support iFrames.</iframe>

:D

As for the back button and all that, I have absolutely no idea whatsoever on how to make it remember all the next inputted.
It's a simple script as said.
@jscheuer1 Try the TXT file and save it as an html.

djr33
02-09-2012, 07:51 PM
As for the back button and all that, I have absolutely no idea whatsoever on how to make it remember all the next inputted.
1. Using an iframe would solve this (because the text input would not disappear).
2. Yes, it's difficult, but unfortunately without this, the script is not very helpful. Why would someone use a script that deletes their code?

[Nicolas]
02-09-2012, 08:32 PM
1. Using an iframe would solve this (because the text input would not disappear).
2. Yes, it's difficult, but unfortunately without this, the script is not very helpful. Why would someone use a script that deletes their code?

Ah. And it is a script tester. Mainly meant for testing scripts but you can transform it into a website creator.

djr33
02-09-2012, 09:15 PM
What I'm saying is that this is more difficult to use than just saving the text in a file and opening that file in a web browser. There are more steps involved, and changing the code doesn't save your work.

To test a file:
1. Open/create new document in notepad.
2. Write code.
3. Save file.
4. Open file in browser. = TEST

To test using this script:
1. Open/create new document in notepad.
2. Write code.
3. Select all, copy code.
4. Go to testing script page.
5. Paste your code.
6. Submit. = TEST


Without some sort of basic "saving" (at least not immediate erasing) function I just can't see how this is helpful. Do you see what I mean?

When creating something new, it is important that the new thing is better than the old thing that it is replacing. Although it isn't significantly harder to use than just editing a text file and opening that in a browser, it is certainly not significantly easier. So I don't see how this is a step forward (or why anyone would use it).

I'm not saying this to be mean-- in some ways, it's a limitation of the browsers. But whatever the reason, it's something you'll need to fix (eg, use an iframe) for this to be a useful script. Scripts here on DD are only useful scripts, not interesting examples of how you coded something. In fact, the way you approached this is creative (and interesting), but the end result isn't something that is productive.

[Nicolas]
02-10-2012, 05:54 PM
I have editing my topic, I added a ZIP attachment to HTMLs that can do that now.