-->
-->
Basic idea to design an online JavaScript and Jquery tool to run and display JS script online:
1) Left panel is the source code of JavaScript and JQuery code, Jquery library is already loaded. Right panel is the running result of JavaScript code:
2) Use HTML form:
<form id="diy_form" action="test1.php" method="post" target="diy_result">
<textarea name="code">
</textarea>
</code>
<p><span><input id="diy_submit" name="submit" value="Run the code" type="submit"></span>
</form>
In test1.php:
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<?php
echo $_POST['code'];
?>
Due to that my server default is to addslashes for all POST data, I need to add stripslashes to reverse
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<?php
echo stripslashes($_POST['code']);
?>
The result:
http://swf.site40.net/jstools/
or
http://www.jiansenlu.zoka.cc/jstools/
To test jQuery: you can use the following code to the left panel:
<a href="http://jquery.com/">jQuery</a>
<script>
$(document).ready(function(){
$("a").click(function(event){
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
});
});
</script>
Online computer courses, code, programming tutorial and sidebar information for monitoring Canadian S&P/TSX index. Build friendship and networking. Welcome to visit my blogs often!!! I also have two other sites: YouTube Channel and Google site.
Adsense
Popular Posts
- PHPWind-- A PHP forum script applcaition in China
- How to blend adsense inside your post?
- Formatting my post
- Notepad++ - Add C++ compiler
- Install PHPMailer 5.2.4 and use smtp gmail
- Set up a child account and set screen time limit in Windows 8
- Wayback Machine - see archived versions of web pages across time
- phpexcel toggle expand and hide column in EXCEL and summary
- Install PHP ibm_db2 extension in Linux (redHat)
- PHP: add a download as pdf file button in report page
No comments:
Post a Comment