我已经在这几个小时了,我根本想不出来.
基本上,我有很长的项目列表,可以在页面中填充.当用户点击其中一个项目时,我想将窗口滚动到最上面的内容将被加载(可能是糟糕的设计,我知道,但这是一个单独的问题).
以下是我的脚本的样子:
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'></script>
<script type='text/javascript' src='scripts/jquery.jgrowl.js'></script>
<script type='text/javascript' src='scripts/javascript.js'></script>
<script type='text/javascript' src='scripts/supersized.js'></script>
<script type='text/javascript' src='scripts/effects.core.js'></script>
<script type='text/javascript' src='scripts/jquery.scrollTo-1.4.2-min.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js'></script>
Run Code Online (Sandbox Code Playgroud)
这是我页面顶部的HTML:
<div id='header'>
<div id='pagetop'></div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是失败的呼叫:
$.scrollTo('#pagetop',800)
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此行时,它不会产生错误消息,因此我知道scrollTo正在正确加载,但是当我进行调用时,它什么都不做.
任何帮助将不胜感激.
我必须设置autocommit为false,并且我已经完成了my.cnf配置文件中的更改。
我已添加autocommit=0用于设置,globally autocommit OFF但autocommit=0在我的my.cnf文件中添加属性后,我的sql服务器未启动。
但是当我评论这个新添加的行时,我的 sql server 正常启动。
我正在用"/etc/init.d/mysql start"这个命令启动我的 sql server 。
设置有问题autocommit false吗?
如果是这样,那么有人请告诉我我该怎么做?
请尽快回复我。
谢谢你。
为什么我这段代码出错?:
function catchevent()
{
eventSrcID=(event.srcElement)?event.srcElement.id:'undefined';
eventtype=event.type;
status=eventSrcID+' has received a '+eventtype+' event.';
}
Run Code Online (Sandbox Code Playgroud)
Firefox说event没有定义.实际上,这是从这里复制的,它清楚地表明它是针对IE5的.我在Ubuntu上使用Firefox 3.6.13.
我的问题不是它在我的浏览器上不起作用的原因.相反,是否有一种方法可以定义event对象,如链接所示,对我的浏览器有效?
UPDATE
为什么这不起作用
<html>
<head>
<script>
function catchevent( e ) {
// reference the proper event object
var e = e || window.event;
// reference the proper target
var srcElem = e.target || e.srcElement; //line no 9
// get the id of the target
var eventSrcID = srcElem.id;
alert(eventSrcID);
}
</script>
</head>
<body>
<a id="link1" href="#" onclick="catchevent()">link1</a>
<a id="link2" …Run Code Online (Sandbox Code Playgroud) 我有一个登录表单,显示在页面顶部.仅当用户未在所有页面中登录时才会出现.我应该在哪里声明生成登录表单的类,以便我可以在我的布局中使用它.我尝试了我的bootstrap课程
protected function _initView(){
$this->bootstrap('view');
$view = $this->getResource('view');
$view->headLink()->appendStylesheet($view->baseUrl('/css/default.css'));
$auth = Zend_Auth::getInstance();
if(!$auth->hasIdentity()) {
$login = new Application_Form_User();
$view->login = $login;
}
Run Code Online (Sandbox Code Playgroud)
}
没有任何工作.我也试过了
protected function _initView(){
$view = new Zend_View();
$view->headLink()->appendStylesheet('http://localhost/backend/public/css/default.css');
$auth = Zend_Auth::getInstance();
if(!$auth->hasIdentity()) {
$login = new Application_Form_User();
$view->login = $login;
}}
Run Code Online (Sandbox Code Playgroud) 我有一个更新查询,我收到错误
Message: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
Run Code Online (Sandbox Code Playgroud)
我想让我的查询显示,以便我可以调试它.任何想法如何做到这一点
编辑::在我的page.php模型上我有和Page模型扩展Zend_Db_Table_Abstract
public static function updatePage($data, $id)
{
$row = new self();
$row->update($data, "page_id = ?".$id);
}
Run Code Online (Sandbox Code Playgroud) 我坚持一个似乎很简单的命令连接,但无法解决它.
我有一个between()功能,它执行以下操作:
/**
* Checks if passed int is between $left and $right
* @param int $left lowest value
* @param int $right highest value
* @param int $value actual value
* @return bool is $value between $left and $right
*/
function between($left, $right, $value)
{
$value = intval($value);
return ( $value >= $left && $value <= $right );
}
Run Code Online (Sandbox Code Playgroud)
而且使用非常简单:
$int = 9;
var_dump( between( 6, 14, $int ) );//bool(true) Run Code Online (Sandbox Code Playgroud)
现在我想要实现的是:
$int = 9;
var_dump( $int.between( 6, …Run Code Online (Sandbox Code Playgroud) 我正在尝试id从url中获取播放列表并将其保存到新变量中.例如,如果用户将其输入到表单中,然后提交该表单
http://www.youtube.com/watch?v=A7izsd5IXq8&playnext=1&list=PL6753173C0F0BE9ED
我只想抓住PL6753173C0F0BE9ED并将其保存到一个新变量中.我试图使用爆炸来做这个,所以它保存了一切后,&list=但我没有太多运气.
有什么想法吗?
谢谢您的帮助!
我正在尝试确定粘贴的网址是否有效.我正在使用bind()函数来检测粘贴事件.我正在使用我在这里找到的正则表达式进行验证(其工作正常并且很好).我还附加一些文字告诉用户它是否是有效网址.
当它在bind()中时唯一不起作用的是URL验证.但是当它放在它外面时它可以工作.
JS:
function validateURL(textval) {
var urlregex = new RegExp( "^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$");
return urlregex.test(textval);
}
$(document).ready(function(){
// assign whatever is in the inputbox to a variable
var url = $("#ent").val()
//this is if they paste the url from somewhere
$("#ent").bind('paste', function() {
if(validateURL(url)) {
$("#ent").css("background-color","green");
$("#status").append("Valid URL");
$("#submit").attr('disabled', 'disabled');
}
});
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<input type="text" name="ent" id="ent">
<input type="submit" name="submit" id="submit">
<div id="status"></div>
Run Code Online (Sandbox Code Playgroud) 我自己做了一个非常小的CMS.登录后,会话设置.
CMS包括某些图像,php页面等.
这些页面还可以包括将数据添加到数据库的表单.
现在的问题是你实际上可以使用一个地址来到显示表单的页面,即;
domain.com/mycms/includes/addpage.php
你会怎么建议保护这个?
注意:当我登录时,一切都必须工作,只是从外面它可能不会显示表单.我可以检查会话是否存在,但我想知道是否有更好更容易的方法.
有没有人知道在不使用php-ajax聊天数据库的情况下消息访问的位置?例子可以在www.phpfreechat.net/上找到
我有一个API调用比特币当我使用这个返回阿雷print_r(),这将是最好的方式来遍历它,这样我可以利用这些数据来生成表格或图表?
[{"volume": 1E+1, "timestamp": 1301982430, "symbol": "mtgoxUSD", "price": 0.62},
{"volume": 1E+1, "timestamp": 1301982430, "symbol": "mtgoxUSD", "price": 0.62},
{"volume": 31, "timestamp": 1301981474, "symbol": "mtgoxUSD", "price": 0.64},
{"volume": 8.592, "timestamp": 1301981466, "symbol": "mtgoxUSD", "price": 0.6401},
{"volume": 10.89, "timestamp": 1301981466, "symbol": "mtgoxUSD", "price": 0.6401},
{"volume": 9.61, "timestamp": 1301981066, "symbol": "mtgoxUSD", "price": 0.641},
{"volume": 1E+1, "timestamp": 1301981058, "symbol": "mtgoxUSD", "price": 0.641},
{"volume": 21.654, "timestamp": 1301981058, "symbol": "mtgoxUSD", "price": 0.641},
{"volume": 2E+1, "timestamp": 1301980388, "symbol": "mtgoxUSD", "price": 0.6729},
{"volume": 1E+1, "timestamp": 1301980373, "symbol": …Run Code Online (Sandbox Code Playgroud) 如何在javascript中为动态创建的输入框分配onkeypress-function?
你可以在这里找到我的源代码:http://goo.gl/9BHSt
var cell2 = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.size = "3";
el.name = 'txtUnit' + iteration;
el.id = 'txtUnit' + iteration;
el.onKeyPress = "return checkIt(event)";
cell2.appendChild(el);
el.type = 'text';
el.size = "3";
el.name = 'txtUnit' + iteration;
el.id = 'txtUnit' + iteration;
el.onKeyPress = "return checkIt(event)";
cell2.appendChild(el);
Run Code Online (Sandbox Code Playgroud)
但是
el.onKeyPress = "return checkIt(event)"; 没有用.为什么?
如何置换列表中的元组.
Run Code Online (Sandbox Code Playgroud)A= [(a,b), (c,d), (e, f)]
如果A是列表,那么使用置换元组,列表是
Run Code Online (Sandbox Code Playgroud)[(a,b), (c,d), (e, f)] [(a,b), (c,d), (f, e)] [(a,b), (d,c), (e, f)] [(a,b), (d,e), (f, e)] ....
它有8个这样的清单.