Frontpage!

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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.
 
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...........................
 
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)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top