我正在使用JQuery Mobile,我在从浏览器到iPhone的扩展方面遇到了麻烦.
当我将它加载到浏览器(safari)上时,它会收缩并扩展得很好.但是,当我将它加载到我的iPhone上时,它无法扩展.它允许您在不应该向左和向右滚动.
是否有一些我应该添加的内容,以便在识别出它是移动设备时缩小规模.
这是我目前的HTML.
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.domain.com/css/jquery.mobile-1.0b1.min.css" />
<link rel="stylesheet" href="http://www.domain.com/css/base.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js">
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
</head>
<body>
<body>
<!-- Start of first page -->
<div data-role="page">
<div data-role="header">
<div id="header">
<ul>
<li>
<div><a href="logout.php">Logout</a>
</div>
</li>
<li style="float:right;">
<div><a href="new.php">New</a>
</div>
</li>
<h1 align="center">Title</h1>
</ul>
<div id="clear"></div>
</div>
</div>
<!-- /header -->
<div id="stream">
<div id="stream_story">
<ul style="width:100%">
<li>
<img src="" />
</li>
<li style="float:right;">></li>
<li style="width:75%;margin-bottom:10px;margin-left:5px;">Content
<br/><span>Content</span> …Run Code Online (Sandbox Code Playgroud) 我正在使用一个简单的脚本在页面上查找图像并获取其来源.
function img_find() {
var img_find2 = document.getElementsByTagName("img")[0].src;
return img_find;
}
Run Code Online (Sandbox Code Playgroud)
然而,当我在我的页面上写这个功能时,它只找到第一个图像,然后停止.打印当前页面上所有图像src的最佳方法是什么?谢谢!
我有一个输入表单,我正在尝试删除/添加点击功能。
这是我的代码:
<script>
$(document).ready(function(){
$("#1").click(function () {
$("#1").hide("");
});
$("#1").click(function () {
$("#twitter").remove();
});
$("#1").click(function () {
$("#2").show("");
});
$("#2").click(function () {
$("#2").hide("");
});
$("#2").click(function () {
$("#1").show("");
});
});
</script>
<span id="1">
<img align="left" src="../images/twitter_blue.png" width="30px;" style="margin:5px;"/>
<div>Share as @<?php echo $_SESSION['username'] ?></div>
</span>
<img align="left" id="2" src="../images/twitter_white.png" width="30px;" style="margin:5px;display:none;"/>
<input id="twitter" type="hidden" name="twitter" value="yes"/>
Run Code Online (Sandbox Code Playgroud)
您可以看到,单击 span id="1" 会删除图像和输入表单。当您单击 img id="2" 时,它会隐藏该图像并恢复原始图像。如何恢复或添加我最初在单击 img id="2" 时删除的输入表单。是否有与 .remove 相对的函数?
谢谢!
所以我的网站上有一个搜索功能,这就是代码的样子.
$search_people = mysql_query("SELECT * FROM glnce_users
WHERE f_name LIKE '%$search%' OR l_name LIKE '%$search%'");`
Run Code Online (Sandbox Code Playgroud)
如果我在我的搜索栏中输入Chris,它将调出所有Chris'
如果我输入我的搜索栏Olson,它将调出所有的Olson
但是如果我输入Chris Olson,即使有一个名字叫Chris的人和olson的姓氏,它也不能为我提供Chris Olson的结果.
我究竟做错了什么?
这是我的html
<a href="index.php"><img id="testimg" src="images/logo.png"/></a>
Run Code Online (Sandbox Code Playgroud)
这是我的 JavaScript
function getW(){
var theImg = document.getElementById('testimg');
return theImg;
}
theImg = getW();
if (theImg.width > 119){
document.write(theImg.width);
}
Run Code Online (Sandbox Code Playgroud)
现在,当我使用这个脚本时,它会输出 img 宽度
但是当我使用这个脚本时
function getW(){
var theImg = document.getElementsByTagName("img");
return theImg;
}
theImg = getW();
if (theImg.width > 119){
document.write(theImg.width);
}
Run Code Online (Sandbox Code Playgroud)
它不输出任何内容。有什么区别以及为什么第二个脚本会起作用?
谢谢!
这就是我目前的代码:
<?php echo $user_join_date; ?>
Run Code Online (Sandbox Code Playgroud)
这就是它的回声:
2011-04-24
我希望它回应这个:
2011年4月4日
最简单的方法是什么?
这是我的代码
if ($follower_username == $user){
echo $followed_username.",";
};
Run Code Online (Sandbox Code Playgroud)
当它运行时,它会回显echos name,name2,name3,name4
但是当我这样做的时候
if ($follower_username == $user){
$names = $followed_username.",";
};
echo $name`;
Run Code Online (Sandbox Code Playgroud)
它只输出name4,
是什么导致它只拉出姓氏?
谢谢!