Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Jquery Mobile时,HTML A HREF会不断添加#和基本url_Javascript_Php_Jquery_Html_Jquery Mobile - Fatal编程技术网

Javascript 使用Jquery Mobile时,HTML A HREF会不断添加#和基本url

Javascript 使用Jquery Mobile时,HTML A HREF会不断添加#和基本url,javascript,php,jquery,html,jquery-mobile,Javascript,Php,Jquery,Html,Jquery Mobile,嗯 我在这里束手无策。我已经阅读了关于锚定标记、基本url和a href中/的用法的问题。然而,无论我做什么,我似乎仍然得到一个锚标签和基础url添加到链接 下面的示例: 当我将鼠标悬停在链接上时,它会显示 但当我点击a href标签时,我会看到下面的内容 HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <met

我在这里束手无策。我已经阅读了关于锚定标记、基本url和a href中/的用法的问题。然而,无论我做什么,我似乎仍然得到一个锚标签和基础url添加到链接

下面的示例: 当我将鼠标悬停在链接上时,它会显示 但当我点击a href标签时,我会看到下面的内容

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Food Loginator</title>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css">
        <link href="../CSS/main.css" rel="stylesheet" type="text/css">
        <script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
        <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
        <script src="../Javascript/gen_validatorv4.js" type="text/javascript"></script>
        <script src="../Javascript/pwdwidget.js" type="text/javascript"></script>
    </head>
<body>
<div data-role="page" id="home">
    <header data-role="header">
        <h1>Food Loginator</h1>
        <div data-role="navbar">
            <ul>
                <li><a href="http://www.localhost:8080/index.php" data-icon="home" data-theme="b" >Home</a></li>
                <li><a href="http://www.localhost:8080/view/login.php" data-icon="star" data-theme="b" >Login</a></li>
                <li><a href="http://www.localhost:8080/view/register.php" data-icon="grid" data-theme="b" class="ui-btn-active">Register</a></li>
            </ul>
        </div>
</header>

食品物流员
食品物流员

欢迎提出任何想法。

这似乎是JQuery移动功能的默认部分。显然,JQuery对a标记中带有#标记的对象执行Ajax调用。然后动态地将该对象添加到DOM中。为了删除它,我必须将rel=“external”添加到我的a标签中


这似乎是JQuery移动功能的默认部分。显然,JQuery对a标记中带有#标记的对象执行Ajax调用。然后动态地将该对象添加到DOM中。为了删除它,我必须将rel=“external”添加到我的a标签中

设置链接href='#'

并添加一个使用changePage的onclick事件调用

function pagechange () {
$.mobile.changePage('index.php');
}
设置链接href='#'

并添加一个使用changePage的onclick事件调用

function pagechange () {
$.mobile.changePage('index.php');
}

我为什么要这么做?如果我理解正确的话。我必须为每个页面设置一个函数,vesus只需添加rel=“external”。我问这个问题是出于真诚的好奇,而不是出于咆哮。我为什么要这么做?如果我理解正确的话。我必须为每个页面设置一个函数,vesus只需添加rel=“external”。我问这个问题是出于真诚的好奇,而不是出于咆哮。