views:

48

answers:

3

I am a little bit lost. What I want to achieve is:

  • my own custom button
  • change onMouseOver etc'
  • keep it's size
  • post the information to a php server side code

What I'm missing is:

  • The post - I couldn't figure out how to combine js & php
  • The Button size - my code sets a size for the original button but after the rollover it changes

The code:

<html>  
<head>
</head>
<body>

    <script>
        function form_on_click(frm) 
        {
            document.buttonMore.src='bottom_more_click.JPG';
            frm.submit();
        }
    </script> 

    <div style="position: absolute; left: 120px; top: 90px; background-image: url(myBackgroundPicture.jpg);
    background-repeat:no-repeat; width: 800px; height: 280px; padding: 15px;">

        <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">            
            <input type="text" name="whatever" size= "55" height="100" lang="en" dir="ltr"  style="margin-top: 188px; margin-left: 95px; height: 20px; background-color: transparent; border:none;
            color: #FFFFFF; font-family: Verdana; font-weight: none; font-size: 18px;">

            <a onmouseover="document.buttonMore.src='bottom_more_hover.JPG'"
            onmouseout="document.buttonMore.src='bottom_more_reg.JPG'" 
            onmousedown= "form_on_click(this.form) this.form.submit()"
            onmouseup="document.buttonMore.src='bottom_more_hover.JPG'">

            <img src="bottom_more_reg.jpg" name="buttonMore" height="30" width="173" border="0" alt="MORE!" style="margin-bottom:-10px; margin-left: 15px; height: 30px; width: 100px;">


            </a>
        </form>


    </div>

</body>

A: 

I'll make the question simpler;

how can I make my own custom button with actions (on-mouse...) + send a php post to server?

Gal Miller
A: 

UPDATED:

Oh sure.. excuse me. You're totally right. I don't know where do I have my head.

Try something else, remove this line again

onmousedown= "form_on_click(this.form) this.form.submit()"

And replace it by

href="javascript:form_on_click(this.form);"

Just a suggestion, why don't you use an...

<input type="button" />

...and then customize it in CSS?

EDIT

About the size of the button, are those jpeg files equally sized?

Hermet
what do you mean? If it's not the default submit button, it is mine, the the click does nothing. even if I make the remark as you did...
Gal Miller
A: 

The easiest way would be to use JQuery. All of what you want to do can be done with just a few simple steps in JQuery. The mouseover/out submit all of it and tons more.

I fell in love with JQuery...

Cory Cullers