PDA

View Full Version : Working with forms, query


cat_evilness
11-24-2002, 01:27 PM
When your working within a form and want to create a link. Can you have it as just a normal link or does it have to be a button?

If you can have it just as a text link then can anyone give me the basic code.

Thankyou,
Cat x

whammy
11-24-2002, 01:58 PM
You can use a normal link within a form. What are you trying to do otherwise?

cat_evilness
11-24-2002, 02:11 PM
I have a variable that is effected by a a button in a form. But I want it so that this variable is effected by a normal text link rather than a button. How would you code this?

Thankyou :rolleyes:

whammy
11-24-2002, 02:12 PM
Can we see the code? :)

cat_evilness
11-24-2002, 02:19 PM
There ya go:

<html>
<head>
<script language="javascript">
<!--
var countdownValue='10';

function countdownScript(){
if(countdownValue>=10){
countdownValue=10
}

if ( countdownValue == 10 || countdownValue == 0 )
document.forms[0].elements[0].disabled = true;
else
document.forms[0].elements[0].disabled = false;

countdown.innerHTML=countdownValue;
if(countdownValue<=0){
clearTimeout(Timer)
}
else{
countdownValue--;
Timer=setTimeout("countdownScript();", 3000);
}
}

function hmm(){
clearTimeout(Timer)
countdownValue+=2
countdownScript()
}

onload=countdownScript
//-->
</script>
<title>Virtual Pet - Version 1.0</title>
</head>
<body bgcolor="#FF9900" text="#ffff99" link="#00ff00" alink="#ffa500" vlink="#ff0000">
<basefont size="3">
<table width="220" valign="top" border="0">
<tr>
<td width="180" bgcolor="#000000" valign="left" align="left" border="0">
Mood:</br>
</td>
<td width="40" bgcolor="#000000" valign="left" align="left" border="0">
<span id="countdown"></span></br>
</td>
</tr>
</table>

<form name=f1>
<input type="button" value="Button" onclick="hmm()">
</form>
</body>
</html>

whammy
11-24-2002, 06:27 PM
<a href="javascript:hmm()">Link</a>

:)