Home Backend Development PHP Tutorial php、该怎么处理

php、该怎么处理

Jun 13, 2016 am 09:59 AM
captcha gt lt quot script

php、
if(){}

else 
{
echo "<script><br /> $(document).ready(function() {$('.captcha').hide(); });<br /></script>";
......php代码,在此省略
}

我想要的结果是当执行else的时候页面中的captcha class的css给隐藏掉。但如上写的代码貌似不对,该怎么在php的判断语句中加jquery代码啊?

------解决方案--------------------
如果代码没有问题的话

PHP code
echo (function($){ $('.captcha').show(); })(jQuery);HTML;$error_msg = elgg_echo('loginerror');<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨

3楼的不对啊,

------解决方案--------------------
此易事尔

if(){

}else
?>
<script>//jquery</script>
 }
?>
------解决方案--------------------
";多了这个,加分吧,,我分少呢
------解决方案--------------------
这段JS代码要放在引入jquery.js文件之后


问题关键在于,最终输出到客户端的html代码是怎样的
------解决方案--------------------
我已经告诉过你了

不过记得,这个输出必须在你的captcha已经正常输出之后进行控制,否则无效。

所以其实你应该这么做 php输出一个隐藏的值例如
echo '';

在整个页面载入之后再根据这个值来执行相应的操作。
JScript code
$(document).ready(function() {    if ($('#fool').val()=='false'){//执行代码$('.captcha').show();  }});<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨

else
{
?>
<script><br />$('.captcha').show(); <br /></script>

这样也不行啊

------解决方案--------------------
你要明白一点 php是运行在服务器端而js和jquery是运行在客户端的,所以在你需要操作的html标签没有显示到客户端的时候,jquery是无法操作这些代码的。理解这点你就知道剩下的怎么做了。
------解决方案--------------------
算了,告诉你一招秘技,一般人我不告诉他,记得给分。。

PHP code
<script src="jquery-1.4.2.js"></script> <div id="dv" style="display:none;width:100px;height:100px;border:1px solid red"></div>  <?php $k='<script>     $(function(){       $("#dv").show(3000);     }) ';     $do=DOMDocument::loadHTML($k);     echo $do->saveHTML(); ?><br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨

我是这么做的,看看对不对啊
else
{
$value = "value";
setcookie("test",$value);

然后在view页里

------解决方案--------------------
document.cookie的用法不是 名=值 一一对应的么? document.cookie="Id=111"; 
就算你的cookie 有内容吧
if (cookies == 'value') 这里怎么是这样判断呢.
getCookie('Id')//获取cookie的值

...

一塌糊涂啊....

http://www.satya-weblog.com/2007/05/php-and-javascript-cookie.html

先看看基本的东西.先仔细的学习一下cookie 在php和js里的用法.




------解决方案--------------------
另外firebug是可以断点调试的,多多用这个功能+alter 慢慢找代码不对的地方吧
------解决方案--------------------
你的描述 有问题啊
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

How to easily bypass human-machine authentication Captcha How to easily bypass human-machine authentication Captcha May 11, 2023 pm 05:55 PM

The Writeup shared today is a simple human-computer authentication (Captcha) bypass method discovered by the author during vulnerability testing of the target website. Captcha bypass was achieved by simply editing elements on the login page of the target website using Chrome developer tools. Pass. Human-machine authentication (Captcha) usually appears on the registration, login and password reset pages of the website. The following is the Captcha mechanism arranged by the target website in the login page. As you can see from the picture above, only after the user checks "I'mnotarobot" of the Captcha verification mechanism, the login button (Sign-IN) will be enabled and displayed for the user to click. So based on this, I right clicked on Si

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

What does script mean? What does script mean? Aug 29, 2023 pm 02:00 PM

Script means script or script. In film, television, drama and other art forms, script is used to describe the dialogue, actions and scenes of characters, as well as the development and structure of the story. Script writing requires certain skills and experience, and it should be vivid and powerful, capable of attracting the audience's attention and conveying the emotions and themes of the story. Scripts are particularly important in the film and television industries. They are the basis of creation and determine the storyline, character development and dialogue content of the film. Script is an important tool for artists to create and express themselves.

Use Beego and Captcha to implement verification code function Use Beego and Captcha to implement verification code function Jun 22, 2023 pm 10:54 PM

With the development and popularization of the Internet, more and more websites and applications have been developed, many of which require verification codes to ensure user validity and security. This article will introduce how to use the Beego framework and Captcha library to implement the verification code function. Among them, Beego is a web application framework based on Go language, and Captcha is an open source verification code library in Go language. Preparation work for the Beego framework. Before implementing the verification code, you need to install the Beego framework and create a new

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

what is script what is script Oct 12, 2023 am 10:04 AM

In the field of computer science, "script" usually refers to a scripting language or script file. A scripting language is an interpreted programming language commonly used for tasks such as automation, batch processing, and rapid prototyping.

See all articles