locked
Image click to do call Javascript function? Is it possible? RRS feed

  • Question

  • User469222686 posted

    I know Javascript support is very limited in Mobile IE but I really want to do this. Nothing I have tried seems to work. It doesn't sound like the hardest thing in the word.

    Can anyone tell me what kind of control I can use? As a start I'd love to see a sample which does an alert("hello world"); when an image is clicked.

    My development will target only Mobile 2003SE or WM5 PDA users and the image click needs to change some text in a label, simple eh?

    Friday, October 6, 2006 10:21 AM

All replies

  • User2098947605 posted

    Apparently this link tells you how to do this...

     http://www.pocketpcskins.com/jsadoce.html

    Tuesday, October 24, 2006 5:16 PM
  • User469222686 posted

    Apparently this link tells you how to do this...

     http://www.pocketpcskins.com/jsadoce.html

     

    Thanks for the response, I nearly opened the champagne when I realised someone had posted an answer!

    Unfortunately I'm not seeing anything on the site which helps, there are some links which might prove useful but nothing about clickable images. Looking at the use of horrible grey buttons in this guy's applications I suspect he has the same problem as I do. I might drop him an email to see if he's still in the game..

     Cheers all the same.

    Wednesday, October 25, 2006 7:23 AM
  • User-225480610 posted

    With ASP.NET 2, you can use the mobile:Command control and specify the ImageUrl property.  This will cause the command button to be rendered as an image instead of a button.  When the image is clicked, you should get a postback and can change the label contents.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="example.aspx.cs" Inherits="Example" %>
    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <body>
        <mobile:Form id="Form1" runat="server">
            <mobile:Command ID="Command1" Runat="server" ImageUrl="~/floppy_disk.gif"></mobile:Command>
        </mobile:Form>
    </body>
    </html>
     

    Tuesday, January 2, 2007 8:44 AM