点击图片并更改文字 [英] click on image and change a text

查看:93
本文介绍了点击图片并更改文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

U在页面和文本框上有2个图像(php)

U have 2 images on a page and a textbox (php)

当你点击图像时,我想改变文本。

When u click on the image i want to change the text.

我是首发者,请发送一个不难理解的代码。

I am a starter, please sent a code that isn't to hard to understand.

<body>
    <img src="bier1.jpg" alt="u mad" onclick= "">
    <img src="bier2.jpg" alt="u mad" onclick= ""><br>

    <form>
    <input type="text" name="Example"/>
    </form>
</body>


推荐答案

我是对的,你想改变文本框的文本?如果是这里的代码:

Are I'm right that you want to change the text of the Textbox? If yes here's the code:

    <body>
        <img src="bier1.jpg" alt="u mad" onclick= "document.forms[0].elements['Example'].value = 'Image 1'">
        <img src="bier2.jpg" alt="u mad" onclick= "document.forms[0].elements['Example'].value = 'Image 2'"><br>

        <form>
        <input type="text" name="Example"/>
        </form>
    </body>

这篇关于点击图片并更改文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆