我正在尝试使用load来重新加载当前页面的一部分(长篇故事为什么)但是我遇到了变量语法的问题.
以下是代码片段:
var pathname = window.location.pathname;
$('#menu').load("/cms.php #menu");
Run Code Online (Sandbox Code Playgroud)
我想用变量替换/cms.php,但是我遇到了纠正语法的问题.
任何帮助/建议都会得到很多批评.
一个.
我可以将资源图像从drawable文件夹加载到位图中,甚至可以进行缩放,但是现在我需要从存储在SD卡上的任何图像中加载图像,我可以看到这将允许我查看和选择;
startActivityForResult(new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), 1);
Run Code Online (Sandbox Code Playgroud)
但到目前为止,我一直无法确切地找出返回的数据以及如何将其加载到位图中.
更新:
这就是我现在所得到的;
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK) {
Uri contentURI = Uri.parse(intent.getDataString());
c = mSurfaceHolder.lockCanvas();
tempCanvas.setBitmap(mDrawing);
Bitmap tempBitmap = null;
ContentResolver cr = getContentResolver();
try {
InputStream in = cr.openInputStream(contentURI);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize=8;
tempBitmap = BitmapFactory.decodeStream(in,null,options);
}
catch (Exception ee) {
tempBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.icon);
}
tempCanvas.drawBitmap(tempBitmap, 0, 0, null);
c.drawBitmap(tempBitmap, 0, 0, null);
mSurfaceHolder.unlockCanvasAndPost(c);
}
}
Run Code Online (Sandbox Code Playgroud)
用logcat显示"app已经意外停止"出错了;
ERROR/AndroidRuntime(24768): …Run Code Online (Sandbox Code Playgroud) 我有两个按钮.如果单击一个按钮,则应显示该文件的第一部分.单击其他按钮时,应显示其他部分.
而且你必须能够随时在这些页面之间切换.
任何人都知道如何做到这一点(在PHP中)?
我正在使用带有Json数据的Extjs4 treepanel.我想重新加载treepanel并需要将树菜单扩展到指定的节点.我正在使用以下代码.请告诉我这是怎么回事.
//Define tree store
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'my_tree.php',
},
noCache: false
});
// Treepanel
var treePanel = Ext.create('Ext.tree.Panel', {
id: 'mytree',
renderTo: 'tree_div',
height: 400,
bodyBorder: false,
border: false,
singleExpand: true,
rootVisible: false,
store: store,
useArrows: true
});
//Reload tree
function reload_tree(){
var tree_panel = Ext.getCmp('mytree');
tree_panel.enable();
tree_panel.getLoader().dataUrl = 'my_tree.php';
tree_panel.getLoader().load(tree_panel.root);
//Expand tree node
tree_panel.getLoader().on('load', function(loader, node){
tree_panel.getNodeById(nodeid).expand();
//here node id is tree menu nodeid
});
}
Run Code Online (Sandbox Code Playgroud)
提前致谢
我有一个容器$('#container'),我想动态地将几个elemtents加载到容器中.我有一个名为subElement.php的php布局.所以我的代码看起来像:
for(i = 0;i<10;i++){
$('#container').load('subElement.php?id='+i,function(data){});
}
Run Code Online (Sandbox Code Playgroud)
只有一个subElement.php布局加载到容器中.我怎样才能以更好的方式做到这一点?
我只需要从我的计算机或网站上读取文本文件.我已经尝试了一切,到目前为止还没有任何工作.它应该非常简单,只需从网站上读取一个文本文件,比如http://foo.com/foo.txt/,但我已经尝试了所有内容,而且我在谷歌上看到的任何内容都无法正常工作.我不在乎如何解决问题,只要我能做到.
我下载了一些空白的wordpress主题文件,并开始用自己的php,html和css填充它们.我使用以下代码来加入google webfont:
function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Tauri');
wp_enqueue_style( 'googleFonts');
}
add_action('wp_print_styles', 'load_fonts');
Run Code Online (Sandbox Code Playgroud)
但我想添加另一个webfont.我尝试了两件事:
1:使用','在wp_register_style中添加它
function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Tauri','http://fonts.googleapis.com/css?family=Muli');
wp_enqueue_style( 'googleFonts');
}
add_action('wp_print_styles', 'load_fonts');
Run Code Online (Sandbox Code Playgroud)
2:重复:
function load_fonts2() {
wp_register_style('googleFonts2', 'http://fonts.googleapis.com/css?family=Muli');
wp_enqueue_style( 'googleFonts2');
}
add_action('wp_print_styles', 'load_fonts2');
Run Code Online (Sandbox Code Playgroud)
不幸的是,两种方式都不起作用 任何人都可以告诉我为什么上面的方法不起作用,以及如何添加多个webfonts.先感谢您!
延迟加载许多(65+)列表项的长列表()的最简单方法是什么?
延迟加载我的意思是只加载视口中可见的列表项.一旦列表项在视口中可见,然后加载它.
我看过许多无限滚动和延迟加载插件,但它们似乎都不仅仅是一个很长的列表.
它们似乎都是一个很长的图像列表,或者是一个与前一个和下一个按钮分页的列表.
我的HTML只是一个包含许多列表项的文本列表,如下所示:
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li> …Run Code Online (Sandbox Code Playgroud) 当id ="Box"的div加载时,我只想提醒'OK'.但是加载功能不起作用.这是我在wordpress中的代码.我已经包含了jquery库和其他jquery工作正常.
jQuery(function(){
jQuery( '#Box' ).load(function() {
alert('ok');
});
});
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用D3而且刚刚开门,我无法上手.我确信解决方案很简单,我无法找到它或理解答案.
我试图在文本文件data.txt中加载数据,但数据没有任何标题; 三列,制表符分隔.
06/20/2014 13:00 3666 -134
06/20/2014 13:10 3744 65
06/20/2014 13:20 3778 2
06/20/2014 13:30 3804 2
06/20/2014 13:40 3865 -1
06/20/2014 13:50 3924 2
06/20/2014 14:00 3939 -173
06/20/2014 14:10 3966 -121
06/20/2014 14:20 3989 -108
06/20/2014 14:30 4000 -117
06/20/2014 14:40 3729 -109
06/20/2014 14:50 4022 -94
06/20/2014 15:00 3794 -204
06/20/2014 15:10 3629 53
06/20/2014 15:20 3572 179
06/20/2014 15:30 3847 166
Run Code Online (Sandbox Code Playgroud)
我想用第二列数据绘制一条线.
我还有一个更大的文件,我想从一行168列长的数据中画一条线:
OFFICIAL,2014-06-30 22:00:00,BAW,361,459,536,591,677,720,725,707,611,524,446,382,339,289,238,183,170,227,393,....
Run Code Online (Sandbox Code Playgroud)
我知道如何根据我的Processing经验来绘制图形,但我无法弄清楚如何获取数据列和D3代码中标识的数据行.