在Web应用程序上使用Phantomjs [英] Using Phantomjs on web application
问题描述
您好 -
我是这个phantomjs的新手,并希望将其合并到我的网络应用程序中,以便用户能够点击按钮它需要一个屏幕截图他们的网页,以便他们以后打开?这有可能我已经搜索了几天,要么我可以从控制台运行phantomjs,但是不知道该做什么或如何从浏览器中做到这一点?我创建了一个非常简单的索引页面,看看我是否可以使用phantomjs并执行我的test.js但没有任何反应。任何帮助都会非常感激。
谢谢
下面是代码:
Hello -
I''m new to this phantomjs and would like to incorporate it into my web app for a user to be able to click a button and it takes a screen shot of their web page for them to open later? Is this possible I''ve been searching for a few days now and either I can run the phantomjs from the console great but dont know exactly what to do or how to do it from the browser? I created a very simple index page to see if i can use phantomjs and execute my test.js but nothing happens. Any help would be so greatly appreciated.
Thanks
Heres the code:
<!DOCTYPE html>
<html>
<head> <title> Phantom </title>
<style>
#change_me {
position: absolute;
top: 100px;
left: 400px;
font: 24px arial;}
#move_up #move_down #color #disappear {
padding: 5px;}
</style>
<script src="scripts/jquery1.9.1.js"></script>
<script src="scripts/test.js"> </script>
</head>
<body>
<button id="move_up">Move Up</button>
<button id="move_down">Move Down</button>
<button id="color">Change Color</button>
<button id="disappear">Disappear/Re-appear</button>
<button onClick="myFunction()" id="phantom">PDF</button>
<div id="change_me">Make Me Do Stuff!</div>
<script>
$(document).ready(function()
{
$("#move_up").click( function()
{
$("#change_me").animate({top:30},200);
});//end move_up
$("#move_down").click( function() {
$("div").animate({top:500},2000);
});//end move_down
$("#color").click( function() {
$("#change_me").css("color", "Red");
});//end color
$("#disappear").click( function() {
$("#change_me").toggle("slow");
});//end disappear
});//end doc ready
console.log("hi");
</script>
<script>
function myFunction()
{
alert("PDF Image saved");
}
</script>
</body>
</html>
推荐答案
( document )。ready( function ()
{
(document).ready(function() {
( #move_up)。click( function ()
{
("#move_up").click( function() {
( #change_me)。animate({top: 30 }, 200 );
}); // end move_up
("#change_me").animate({top:30},200); });//end move_up
这篇关于在Web应用程序上使用Phantomjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!