开发者

using php and java script in a form

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-re开发者_如何学Cpeat: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>


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?


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜