1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Frontpage!

Discussion in 'Software Development' started by ckaas, Oct 5, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. ckaas

    ckaas Thread Starter

    Joined:
    Feb 3, 2003
    Messages:
    133
    hey again everybody. I'm working on this website for my school and i have a page with a contact form on it. i also have a letter clipart outside the form area. what i have been trying to do, unsuccessfully, is to set up a DHTML effect so that when the user clicks on the "Sumbit" button, the letter flies off. Is there any way to do that? Thanks:);)

    Christian K.
     
  2. wizzkid

    wizzkid

    Joined:
    Jan 7, 2003
    Messages:
    662
  3. eddie5659

    eddie5659 Moderator Malware Specialist

    Joined:
    Mar 19, 2001
    Messages:
    33,391
    Moved you to Developement :)
     
  4. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    hi Christian....

    what is the action of your submit???

    normally, a form submits.... and an action occurs (like submitting to a different page).

    I'm not going to say that you can't have the action also fire a different event (such as moving an object on the page)....
    but if the form is submitting.... the objects on the form page won't matter much once the user submits the form.

    I can provide you with some code..... but I don't think that it is applicable to be used with an onSubmit action.

    Give me a sec to type it out.....
    then you can apply it to whatever action you want to attach it to (although.... like I said.... a form submission does not seem to be the proper event for it)

    give me a sec...........................
     
  5. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    okay Christian.....

    here is some code that moves an object.

    it's attached to an event that is fired by clicking a link....
    you can modify it as needed.

    like I said....
    a form is not really suited to this action....
    but feel free to get imaginative (that's what DHTML is all about :) )

    have fun :)

    <html>
    <head>
    <title>move object</title>
    <script>
    var isDHTML = 0;
    var isLayers = 0;
    var isAll = 0;
    var isID = 0;

    if (document.getElementById) {isID = 1; isDHTML = 1;}
    else {
    if (document.all) {isAll = 1; isDHTML = 1;}
    else {
    browserVersion = parseInt(navigator.appVersion);
    if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1;

    isDHTML = 1;}
    }}

    function findDOM(objectID,withStyle) {
    if (withStyle == 1) {
    if (isID) { return (document.getElementById(objectID).style) ; }
    else {
    if (isAll) { return (document.all[objectID].style); }
    else {
    if (isLayers) { return (document.layers[objectID]); }
    };}
    }
    else {
    if (isID) { return (document.getElementById(objectID)) ; }
    else {
    if (isAll) { return (document.all[objectID]); }
    else {
    if (isLayers) { return (document.layers[objectID]); }
    };}
    }
    }
    </script>
    <script language="javascript">
    function moveObjectTo(objectID,x,y) {
    var domStyle = findDOM(objectID,1); domStyle.left = x; domStyle.top = y;
    }
    </script>
    <style type="text/css">
    #ob {
    position: absolute;
    top: 100px;
    left: 30px;
    font-size: 50px;
    font-weight: bold;
    color: #c00;
    }
    </style>
    </head>

    <body>
    <a href="javascript:void('')" onClick="moveObjectTo('ob',500,350);">Click Me</a>
    <div id="ob" >
    Your Letter
    </div>
    </body>
    </html>

    NOTE: No space between "java" and "script" in this line:
    <a href="javascript:void('')"
    (the forum sticks that in there)
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/169628

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice