佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1209|回复: 14

php的submit button 加入 class

[复制链接]
发表于 3-8-2010 09:29 PM | 显示全部楼层 |阅读模式
本帖最后由 gee9043 于 3-8-2010 10:23 PM 编辑

<a class='example' href="other.html">link to other</a>   <--- 这个是一个 ajax pop up

如果按下submit 按钮的话, 也执行上面这段...可以吗?
因为有class的, 所以要怎样编写呢?

想加入html和php的submit button 里面.

php

当接收到submit 请求
value 正确时, 才 执行 <a class='example' href="other.html"> <--- 这个是一个 ajax pop up

可以吗?  请问怎样编写呢?

link.php

    <?php
$li=$_POST["li"] ;
if($li!="")
{run <a class='example' href="other.html">}   <--- 这个是一个 ajax pop up
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="submit" name="li" value="发送">
</form>


这个{run <a class='example' href="other.html">}  <--- 这个是一个 ajax pop up

请问要怎样写?
回复

使用道具 举报


ADVERTISEMENT

发表于 3-8-2010 09:45 PM | 显示全部楼层
不明白你要什么。。。
可以解释吗??
回复

使用道具 举报

 楼主| 发表于 3-8-2010 09:54 PM | 显示全部楼层
不明白你要什么。。。
可以解释吗??
lawty 发表于 3-8-2010 09:45 PM


___________________________________________

link.php

    <?php

$li=$_POST["li"] ;

if($li!="")
{run <a class='example' href="other.html">}
?>

<form method="post" action="" enctype="multipart/form-data">
<input type="submit" name="li" value="发送">
</form>


这个{run <a class='example' href="other.html">}

要怎样写?
回复

使用道具 举报

发表于 4-8-2010 12:36 AM | 显示全部楼层
都不懂你在说什么...那个link是ajax pop up? 你想redirect去other.html?还是你要pop up一个other.html 的window?
回复

使用道具 举报

 楼主| 发表于 4-8-2010 12:46 AM | 显示全部楼层
都不懂你在说什么...那个link是ajax pop up? 你想redirect去other.html?还是你要pop up一个other.html 的wi ...
Legend 发表于 4-8-2010 12:36 AM



    抱歉 -__- 表达能力可能有点差...是pop up一个other.html
回复

使用道具 举报

发表于 4-8-2010 09:24 AM | 显示全部楼层
如果你只是要确定'li'里面是否有value,
那你应该在javascript做这validation,
就不需要再回到server side(php)做。
过后再用javascript启动你的other.html,
就简单得多了
回复

使用道具 举报

Follow Us
发表于 4-8-2010 04:54 PM | 显示全部楼层
回复 3# gee9043


你可以echo “<script>window.open('other.html')</script>”;
回复

使用道具 举报

 楼主| 发表于 4-8-2010 07:48 PM | 显示全部楼层
回复  gee9043


你可以echo “window.open('other.html')”;
Legend 发表于 4-8-2010 04:54 PM


这个是pop up, 但是有(class='example5')
<p><a class='example5' href="lol.html" title="Homer Defined">Outside HTML (Ajax)</a></p>

if($a!="")
{echo "<script>window.open(lol.html)</script>" ; }

请问(class='example5') 要放在那里呢?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 4-8-2010 07:49 PM | 显示全部楼层
如果你只是要确定'li'里面是否有value,
那你应该在javascript做这validation,
就不需要再回到server si ...
bpchia 发表于 4-8-2010 09:24 AM



    我也很想 -__-  但是我不会js...
回复

使用道具 举报

发表于 4-8-2010 11:22 PM | 显示全部楼层
回复 8# gee9043


你的class="example5"用来做么的? css styling?
回复

使用道具 举报

 楼主| 发表于 5-8-2010 01:57 AM | 显示全部楼层
回复  gee9043


你的class="example5"用来做么的? css styling?
Legend 发表于 4-8-2010 11:22 PM



            <link media="screen" rel="stylesheet" href="colorbox.css" />
        <script src="jquery.min.js"></script>
        <script src="jquery.colorbox.js"></script>
        <script>
            $(document).ready(function(){
                $(".example5").colorbox();
            });
        </script>

应该算是ajax pop up.
回复

使用道具 举报

发表于 5-8-2010 09:42 AM | 显示全部楼层
回复 11# gee9043

原来...如上面所说,如果只是要确定li有没有value的话,就写个javascript 的function就可以了...如果你一定要submit去server的话就用ajax咯...jquery我不大会写...submit button放个id="li"...大概是将
$('#li').click(function() {
  if($('#li').val()!='') $(".example5").colorbox();
});
回复

使用道具 举报

 楼主| 发表于 5-8-2010 12:27 PM | 显示全部楼层
回复  gee9043

原来...如上面所说,如果只是要确定li有没有value的话,就写个javascript 的function就可 ...
Legend 发表于 5-8-2010 09:42 AM


_____________________________________________________________

<script>
$(document).ready(function(){
$(".example5").colorbox();
});
            
            
$('#li').click(function() {
  if($('#li').val()!='') $(".example5").colorbox();
});
        </script>
_____________________________________________________

<form method="post" action="" enctype="multipart/form-data">
<input type="submit" name="li" id="li" value="发送">
</form>


是这样吗? 貌似不行哦...
回复

使用道具 举报

发表于 5-8-2010 01:35 PM | 显示全部楼层
_____________________________________________________________


$(document).ready(function(){ ...
gee9043 发表于 5-8-2010 12:27 PM


是哦,不能这样call,那就这样好了..
$(document).ready(function(){
  $('#li').click(function() {
    if($('#li').val()!='') $("#li").colorbox({href:"other.html"});
  });
});
回复

使用道具 举报

 楼主| 发表于 8-8-2010 11:02 AM | 显示全部楼层
是哦,不能这样call,那就这样好了..
$(document).ready(function(){
  $('#li').click(function() {
...
Legend 发表于 5-8-2010 01:35 PM



    可以了哦....谢谢...
但是你会把这段话换成是php的吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 21-11-2025 08:04 AM , Processed in 0.146965 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表