小编cir*_*cey的帖子

可以替换window.location.hash?

我想知道是否可以更改window.location.hash中的哈希并将其替换为'this.id'.或者我需要更改整个window.location?

javascript jquery window.location

34
推荐指数
1
解决办法
3万
查看次数

从window.location.hash中删除#

我有这个简单的脚本:

$(document).ready(function(){

var $yoyo = window.location.hash;

alert($yoyo);

});
Run Code Online (Sandbox Code Playgroud)

但我需要摆脱#符号,因为我将使用变量来定位div ID.我尝试过使用.remove('#'),但这似乎不起作用.

提前谢谢了!

jquery window.location

30
推荐指数
2
解决办法
6万
查看次数

更改google-maps多边形颜色/填充单击

我有以下代码已传递给我并创建多边形:

<script type="text/javascript">

var map;
function initialize() {
    var myLatlng = new google.maps.LatLng(-36.42,145.710);
    var myOptions = { zoom: 15, center: myLatlng, mapTypeId: google.maps.MapTypeId.SATELLITE }

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    // Create polygon overlays from site data in file data.js included above
    // Overlays are defined by a set of coordinates
    // We will also be setting up an infowindow with the site name
    // The infowindow will be designed to point to the 'center' of each site so we calculate …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

29
推荐指数
2
解决办法
5万
查看次数

在require_once中使用常量

我在开发过程中使用以下命令定义root:

define('LOCAL_URL', 'http://localhost/~xampp/Mysite');
define('REMOTE_URL', 'http://example.com');
define('DEV_VERSION', true);
if(DEV_VERSION)
    define('URL', LOCAL_URL);
else
    define('URL', REMOTE_URL);
Run Code Online (Sandbox Code Playgroud)

这个概念对我来说是新的,我是一个PHP初学者,所以请温柔.

我正在尝试在'require_once'中使用'URL'而我似乎无法使其工作(因为不包括所需的文件).我尝试过以下方法:

require_once URL.'/phpincludes/coming-events.php';
require_once(URL.'/phpincludes/coming-events.php');
require_once URL . '/phpincludes/coming-events.php';
require_once (URL . '/phpincludes/coming-events.php');
require_once(URL.'phpincludes/coming-events.php');
Run Code Online (Sandbox Code Playgroud)

我查了http://www.php.net/manual/en/function.require-once.php并在Stackoverflow上搜索过,我根本没有取得任何进展.

我确定这是我在这里犯下的一个非常愚蠢和基本的错误,但我很茫然,非常感谢一些帮助!

php require-once

6
推荐指数
1
解决办法
2190
查看次数

脚本没有在Safari和Chrome上运行document.ready(FF好的),但适用于document.resize

我有以下jquery脚本来调整图像大小并给它左边距以水平居中.该脚本在FF中完美运行,但在Safari和Chrome中我遇到了问题.

Safari和Chrome问题:图像调整大小正常,但左图像似乎在图像调整大小之前设置,导致图像被推得太远.仅在document.ready上发生此问题.调整浏览器大小时,脚本运行正常.

function imageresize() {
    var h = $(window).height(),
        w = $(window).width(),
        newHeight = h * 0.5,
        newTopMargin = newHeight * 0.12;

        $('img.resize').css({'height' : newHeight + 'px', 'margin-top' : '-' + newTopMargin + 'px'});
    var leftMargin = (w - ($('img.resize').width()))/2;
        $('img.resize').css('margin-left', leftMargin + 'px');

}
$(document).ready(function() {
  imageresize();
});

$(window).resize(function() {
  imageresize();
});
Run Code Online (Sandbox Code Playgroud)

脚本放在之前</body>.

任何帮助将不胜感激!

jquery cross-browser

5
推荐指数
1
解决办法
2万
查看次数

如何停止和播放jquery脚本

我正在使用slidejs在单页网站上创建5个不同的幻灯片/画廊.他们都有'.slides'类,并有自己的ID.

在调用播放功能之前,我不希望播放任何幻灯片.我已经能够使用以下内容成功阻止每个幻灯片播放onload:

    function initiateSlides() {
    $('.slides').slides({
        generateNextPrev: true,
        fadeSpeed: 800,
        hoverPause: true,
        play: 3000,
        pause: 2500,
        preloadImage: 'images/loading.gif',
        effect: 'fade'
    });
    clearInterval($('#projects-commercial-slides').data('interval'));
    clearInterval($('#projects-residential-slides').data('interval'));
    clearInterval($('#projects-hospitality-slides').data('interval'));
    clearInterval($('#projects-public-slides').data('interval'));
    clearInterval($('#projects-industrial-slides').data('interval'));
}
Run Code Online (Sandbox Code Playgroud)

(使用类'.slides'不会停止幻灯片放映,因此使用ID.)但是,我现在无法播放任何幻灯片.我尝试过以下方法:

function playSlides() {
    $('#projects-residential-slides').animate();
}

function playSlides() {
    $('#projects-residential-slides').play();
}

function playSlides() {
    $('#projects-residential-slides').animate({
        animationStart:0
        });
}

function playSlides() {
    $('#projects-residential-slides').animate('next',fade);
}
Run Code Online (Sandbox Code Playgroud)

感谢您的建议,因为我已经工作了几天(!).我很欣赏我可能不会阻止幻灯片以最优雅的方式播放.完整的slides.jquery.js在这里:

    /*
* Slides, A Slideshow Plugin for jQuery
* Intructions: http://slidesjs.com
* By: Nathan Searles, http://nathansearles.com
* Version: 1.1.8
* Updated: June 1st, 2011
*
* Licensed …
Run Code Online (Sandbox Code Playgroud)

jquery function

5
推荐指数
1
解决办法
6070
查看次数

修改webkitdragdrop.js使用类而不是ID

我找到了一个看起来非常适合我的需求的脚本,但是它使用ID而不是类来创建对ipad友好的拖放元素.

我真的需要它来使用类,因为可拖动元素可能成千上万.

[编辑]我在javascript上并不是那么棒,并且我很难理解如何改变脚本以使用类而不是ID.

我也联系了剧本作者,但没有得到他的答复.

我提供这笔赏金,因为我对原始查询没有任何回应.

请有人可以更改下面的脚本,以便它使用类吗?[/编辑]

下面是完整的脚本,这是脚本页面(API对我能够使用类vs id没有帮助).

// webkitdragdrop.js v1.0, Mon May 15 2010
//
// Copyright (c) 2010 Tommaso Buvoli (http://www.tommasobuvoli.com)
// No Extra Libraries are required, simply download this file, add it to your pages!
//
// To See this library in action, grab an ipad and head over to http://www.gotproject.com
// webkitdragdrop is freely distributable under the terms of an MIT-style license.


//Description
// Because this library was designed to run without requiring any …
Run Code Online (Sandbox Code Playgroud)

javascript drag-and-drop ipad

5
推荐指数
1
解决办法
550
查看次数

opencart,导入客户

我有3个问题.

我有一个新的Opencart网站和500多个客户要添加.我发现了几个导入客户扩展,但是支持似乎已经失败了,并且似乎没有1.5.5.1的工作版本所以我正在寻找使用xls文件导入mysql.

我的疑问如下:

查询1:我需要上传2个表:(a)地址; (b)客户.这些是唯一需要改变的表吗?

问题2:我看到密码是MD5加密的.我已经拥有所有500多个客户的密码 - 我是否必须将这些密码转换为MD5,或者我可以使用未加密的密码而db会为我进行加密吗?

问题3:如何处理Customer表中的Salt字段?我可以留空吗?

3 x MTIA!

import opencart

3
推荐指数
1
解决办法
3453
查看次数

从mysql表中列出数据

recipe_category

cid | category
 1  | desserts
 2  | cakes
 3  | biscuits
Run Code Online (Sandbox Code Playgroud)

recipe_name

id | recipe_name       | cid | iid
 1 | black forest cake | 1,2 | 1,2,3,4
 2 | angel cake        | 2   | 1,2,4
 3 | melting moments   | 3   | 2,5
 4 | croquembouche     | 1,3 | 1,5
Run Code Online (Sandbox Code Playgroud)

配料

iid | ingredient_name
 1  | self-raising flour
 2  | milk
 3  | chocolate
 4  | baking powder
 5  | plain flour
Run Code Online (Sandbox Code Playgroud)

我能够使用cid拉取某些食谱来查询数据库,即.甜点:

SELECT * …
Run Code Online (Sandbox Code Playgroud)

mysql multiple-tables

2
推荐指数
1
解决办法
171
查看次数

电话号码从ipad网站上消失

我发现这是一个完全"WTF"的情况.在这个网站上,在ipad和iphone上查看时,联系页面的电话号码消失了.在其他所有方面,电话号码显示正确.主页上有一个电话号码,可以在ipad和iphone上正确显示,但联系页面上的数字却没有.

我试过了:

  • 删除联系人页面和/或头文件中的其他表单脚本.结果:数字仍然不显示;
  • 使用html字符而不是+,(和).结果:数字仍然不显示;
  • 使用字母而不是数字.结果:文本正确显示;
  • 将联系人页面中的电话号码复制并粘贴到主页.结果:数字在主页上正确显示
  • 将联系人页面中的电话号码复制并粘贴到其他页面.结果:数字不显示;
  • 检查不可见的字符.结果:没有不可见的字符.

我发现了另一个与此问题相关的问题,但它已被关闭,因为它不是一个真正的问题.

请在下面找到我的代码:

    <p><em>A &amp; K Ross Associatest Pty Ltd</em><br>
    3 Gunyah Drive<br>
    Trentham<br>
    Vic 3458 Australia<br>
    Email: info@akra.com.au<br>
    Telephone: + 61 (0)3 5424 1700</p>
    <p><em>Alan Ross</em><br>
    Mobile: +61 (0)407 842 537</p>
    <p><em>Katherine Ross</em><br>
    Mobile: +61 (0)438 120 704</p>
Run Code Online (Sandbox Code Playgroud)

是的,当然,这可能是我在某个地方犯过的一个荒谬的错误,但我不能为我的生活找到我做过的地方.

我真的很感激一些帮助.MTIA.

编辑:

我没有使用任何特定于移动/手持设备或屏幕宽度等的样式.应用于文本的CSS样式如下:

.contact p {
line-height:18px;
margin-bottom:13px;
}
p {
color:#858585;
font-family:Arial,Helvetica, sans-serif;
font-size:13px;
width:630px;
}
Run Code Online (Sandbox Code Playgroud)

html php phone-number ios

2
推荐指数
1
解决办法
5045
查看次数

php文件扩展名:security issue?

我是一个自学成才的编码器,我正在进入php,所以请原谅我这是一个基本的问题/问题.

我一直在使用php和使用php文件扩展名组建小型网站,即.index.php文件.但我最近被告知页面地址中的"php"不利于安全性.

有人可以简单解释为什么会出现这种情况以及我应该做些什么?

MTIA.

php security

1
推荐指数
1
解决办法
126
查看次数

php本地和远程工作在自己的托管上,但不是远程客户端托管

我对PHP不好,所以请耐心等待.我有以下代码:

<?php $thisPage="designers";
include("phpincludes/header.php") ?>

<div id="contentLeft">
<?echo "<h2><a href='designer_display.php?d_name=".$_GET['d_name']."'>" . $_GET['d_name']. "</a></h2>";?>

<?
    error_reporting(0);
    require_once "phpincludes/connection.php";

    $designer = $_GET['d_name'];
    // Category Selection Start.
    $cat_qry = "SELECT DISTINCT (
        `own_category`
    )
    FROM  `products` 
    WHERE  `designer` ='".$designer."' && own_category !=  ''";
        $rs_qry = mysql_query($cat_qry);

            $i = 0;

        while($rec_qry = mysql_fetch_array($rs_qry))
        {
          if($i==0)
            $first_cat = $rec_qry['cat_name'];
            $cat_name[$i]=$rec_qry['cat_name'];
            $i++;
        }

        // Category Selection Start.
        $cat_name = $_GET['catName1'];
        $cat_qry =  "SELECT DISTINCT (
        `own_category`
        )
        FROM  `products` 
            WHERE  `designer` ='".$designer."' && own_category !=  ''"; …
Run Code Online (Sandbox Code Playgroud)

php mysql

1
推荐指数
1
解决办法
91
查看次数

调整div背景图像的大小

我必须在3个div中设置背景图像(精灵png).我需要pngs以div大小调整大小,因为它是一个流畅的布局.

我四处寻找解决方案,只能<img>在html中找到解决方案.我很欣赏这将是一种处理情况的简单方法,但需要使用背景图像.我需要一个背景图像的解决方案 - <img>请不要使用建议!

我意识到css3提供了一个可能的后台大小的解决方案,但这对IE7和IE8以及其他非css3浏览器没有帮助.我很高兴使用jquery,但不能想到我如何动态调整png以适应div.

我真的很感激一些帮助,但请理解我无法使用<img>.

这是我的css:

a.bigButton {
height:30%;
width:30%;
display:block;
float:left;
}
a.bigButton#btn-menus:link {
background:url(images/btn-menus-large.png) top center no-repeat;
background-position: 0 0;
}
a.bigButton#btn-menus:hover {
background-position: -298px 0;
}
a.bigButton#btn-functions:link {
background:url(images/btn-functions-large.png) top center no-repeat;
background-position: 0 0;
}
a.bigButton#btn-functions:hover {
background-position: -298px 0;
}
a.bigButton#btn-packages:link {
background:url(images/btn-av-large.png) top center no-repeat;
background-position: 0 0;
}
a.bigButton#btn-packages:hover {
background-position: -298px 0;
}
Run Code Online (Sandbox Code Playgroud)

我的HTML:

<div id="quick-links-holder">
<a href="#" alt="Check out our menus" class="scroll bigButton btnResize" id="btn-menus"></a> …
Run Code Online (Sandbox Code Playgroud)

html css jquery background-image

1
推荐指数
1
解决办法
4805
查看次数