我想使用jQuery打印div的内容.这个问题已经在SO中提出,但我找不到正确的(有效的)答案.
这是我的HTML:
<div id='printarea'>
<p>This is a sample text for printing purpose.</p>
<input type='button' id='btn' value='Print'>
</div>
<p>Do not print.</p>
Run Code Online (Sandbox Code Playgroud)
在这里,我想打印div的内容printarea.
我试过这个:
$("#btn").click(function () {
$("#printarea").print();
});
Run Code Online (Sandbox Code Playgroud)
但是单击按钮时会出现控制台错误:
未捕获的TypeError:$(...).print不是函数
但是当我尝试使用打印整个页面时
window.print();
Run Code Online (Sandbox Code Playgroud)
这是工作.但我只想打印特定div的内容.我$("#printarea").print();在许多地方看到了答案,但这不起作用.
我可以在jQuery中使用标头位置进行重定向或刷新吗?
像PHP一样:
header('location:www.google.co.in');
header("Refresh:1,url=home.php");
Run Code Online (Sandbox Code Playgroud)
如果没有,替代方式是什么?
我必须以编程方式向客户的whatsapp号码发送消息.
什么是预先要求/需求?
我是否需要将我的个人号码转换/注册到商业帐户?
whatsapp是否为此提供了任何API?
Indian Rupee symbol(?)未显示在发票pdf中magento.在system-> manage currency-> symbols I save currency symbolas ?.
然后pdf看起来:

我将system-> manage currency-> symbols中的符号更改为 ₹
那么pdf看起来像这样:

如何?在pdf(发票,订单等)中正确显示Magento.?
我有HTML
Name 1:<input type="text" class="one" id="mytext">
<button onclick="disfunction()"></button>
Run Code Online (Sandbox Code Playgroud)
使用Javascript
function disfunction(){
document.getElementsByClassName("one").disabled = true;
}
Run Code Online (Sandbox Code Playgroud)
但文本框仍然启用.我如何禁用 text box使用类名的JAVASCRIPT.
使用id我可以做到这一点.还使用jquery.
但我需要一个使用Javascript和的解决方案classname.
我必须下载一个file (pdf/zip/txt ...)使用jquery.
我试过了什么?
<a href="abc.pdf">click</a>
Run Code Online (Sandbox Code Playgroud)
当我点击链接时,文件在浏览器中打开.
使用jquery ...
$('a').click(function(e)
{
e.preventDefault();
var link = $(this).attr('href');
window.location = link;
});
Run Code Online (Sandbox Code Playgroud)
这也导致在浏览器中打开文件.但我想下载它不在浏览器中显示.
在PHP我们可以使用header('Content-Disposition: attachment; filename="test.mp3"');
但我必须只使用 jquery/javascript..
我安装wamp 在服务器和本地机器上.在本地机器上这很好用.但是服务器中发生了一些问题.当我登录到phpmyadmin #1045无法登录到MySQL服务器时显示错误.我怎么能解决这个问题?
我的config.inc.php文件包含以下代码
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
//$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'admin';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Run Code Online (Sandbox Code Playgroud)
请帮帮我..谢谢..
I have a string searchval = "php,java,html".
I want to check any of the comma separated value in string exist in column keyword in my below table.
My table
id keyword
-----------------------------
1 java,php
2 jquery, javascript
3 java
4 php,jquery
Run Code Online (Sandbox Code Playgroud)
Any of the searchval(comma separated) value match the keyword(comma separated) should return the id.
So the result should be:
1 (java,php is there),
3 (java is there),
4 (php is there)
Run Code Online (Sandbox Code Playgroud)
How can I do this?
我有一个带有posttext的文本区域.
我试图获取textarea的值,但.html()和.text()始终在Production中返回null.但.val()返回正确的值.我使用IIS作为Web服务器.
alert($("#posttext").html()); // returns empty
alert($("#posttext").val()); //returns the correct values
alert($("#posttext").text()); // returns empty
Run Code Online (Sandbox Code Playgroud)
当我在本地运行时,代码工作正常,那么是否有任何设置在生产中搞砸了?有什么办法调试?由于它是一个ajax加载形式,我无法在视图源中看到textarea.
谢谢
当我点击一个链接时,新的链接window会打开。但我不能resize(也maximize)window在IE浏览器。
但我可以resize和maximize 该window浏览器是否是铬或火狐等。
我的代码是:
$("#linkId").click(function(){
//window.open('../blocks/eparticipation/view.php?cId='+courseId, 'chatWindow', 'location=1,status=1,scrollbars=1, width=1000,height=500');
window.open('../blocks/eparticipation/eparticipation_home.php?cId='+courseId, 'chatWindow', 'location=1,status=1,scrollbars=1, width=1000,height=500');
return false;
});
Run Code Online (Sandbox Code Playgroud) 我有开始时间、结束时间和间隔。
我必须获取开始时间和结束时间之间的时间段。
我有
var starttime = "09:50:00";
var endtime = "10:50:00";
var interval = "10";
Run Code Online (Sandbox Code Playgroud)
我想要time slotsas 数组
var timeslots = ["09:50:00","10:00:00","10:10:00","10:20:00","10:30:00","10:40:00","10:50:00"];
Run Code Online (Sandbox Code Playgroud)
、starttime和endtime可能interval会有所不同。如何获得想要的时隙?
要将间隔添加到我的时间中:
function addMinutes(time, minsToAdd) {
function D(J){ return (J<10? '0':'') + J;};
var piece = time.split(':');
var mins = piece[0]*60 + +piece[1] + +minsToAdd;
return D(mins%(24*60)/60 | 0) + ':' + D(mins%60);
} //this is working
Run Code Online (Sandbox Code Playgroud)
我在下面尝试生成time slot数组。
var starttime …Run Code Online (Sandbox Code Playgroud) 我正在使用Opencart版本2.0.3.1.
当客户订购产品时,订单邮件不会发送给管理员.但订单邮件已成功发送给客户.
那么如何在用户在Opencart中订购产品时将订单邮件发送给管理员?
我的Mail设置如下所示:
其他邮件,如联系我们等工作正常..
我有一张桌子:发票
inv_id cus_id due_amt paid total_due
1 71 300 0 300
2 71 200 0 500
3 71 NULL 125 375
4 72 50 0 50
5 72 150 0 200
Run Code Online (Sandbox Code Playgroud)
我想要结果
cus_id total_due
71 375
72 200
Run Code Online (Sandbox Code Playgroud)
这是我想total_due的unique customer或以其他方式可以说我需要latest invoice的细节unique customer。
我试过的:
SELECT cus_id, total_due FROM invoice GROUP BY cus_id ORDER BY inv_id DESC
但这并没有给出所需的结果。
请有人可以帮助我..
jquery ×6
php ×5
html ×3
javascript ×3
mysql ×2
email ×1
group-by ×1
magento ×1
opencart2.x ×1
pdf ×1
phpmyadmin ×1
postgresql ×1
printing ×1
resize ×1
sql ×1
wamp ×1
whatsapi ×1
whatsapp ×1
window ×1