search
Homephp教程php手册利用来巧妙实现map功能...

大家都熟悉HTML标记里的MAP标记吧~,他可以将一个图片进行多个热链接定位,也就是说一个图片可以链接到N个文件~

我现在所说的是,这一个图片他所链接只有一个文件~

呵呵,别抛砖头~,你恐怕说直接用一个标记不就可以链接了吗?
等等,
你稍微等一下嘛~,让我继续说下去~

我需要在下一个页面进行操作,也就是说一个图片在不传递参数的情况下,要让下一个页面要有不同的反映动作,怎么说呢?
比如说

A、通过点击图片左上我要进如pagea.php 右上我要进pageb.php
如此,你也许要说用MAP直接链接就行了,但我要在这个页面对上一页面进行统计,
怎么办呢?`


别急~

HTML标记


PHP对此标记支持的自动生成两个变量
$_POST[thisname_x] --鼠标点击图片的X位置
$_POST[thisname_y] --鼠标点击图片的Y位置

呵呵,看到这里晓得了如何操作了吧~,下面我给个简单的示例(直接拷贝过去就可以了,如果改的话把图片改为你的正确的图片路径就可以了~)~


演示:
======

index.html
----------


测试信息










post.php


操作...


<br><?php <br/>$c=getimagesize("$_POST[image]");    //获得图片尺寸<br><br>if($_POST[sub_x]<br>    if($_POST[sub_y]        echo "你点击了图片的左上半部分 x={$_POST[sub_x]} y={$_POST[sub_y]}";<br>    }else{<br>        echo "你点击了图片的左下半部分 x={$_POST[sub_x]} y={$_POST[sub_y]}";<br>    }<br>}else{<br>    if($_POST[sub_y]        echo "你点击了图片的右上半部分 x={$_POST[sub_x]} y={$_POST[sub_y]}";<br>    }else{<br>        echo "你点击了图片的右下半部分 x={$_POST[sub_x]} y={$_POST[sub_y]}";<br>    }<br>}<br>?><br>






以上是个人对这个image提交变量的简单应用,如果你有巧妙的创意~

肯定可以做出一个图形作为引导的站点~



Statement
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor