A few hints.
1. use
<A HREF="javascript:;" onClick="someFunction(); return false">call function</A>
otherwise any animations on the page stop and the cursor in Netscape does not reset from the hourglass until moved
2. LY: use slightly more descriptive function names - I know prakashk is a perl expert and probably LIKES short names, but it does make it harder to see what is going on...
3. Pass the form object from where it is called. That way the function does not have to care about what the name is:
<form name="formA">
<input type="text" name="field1" value="">
<input type="text" name="field2" value="">
<Input Type="TextArea" Name="Output">
</form>
<a href="javascript:;" onClick="processForm(docum
where processForm looks like this:
processForm(theForm) {
theForm.Output.value = parseInt(theForm.field1.va
}
or
<a href="javascript:;" onClick="processForm(docum
where processForm looks like this:
processForm(val1,val2,theF
theForm.Output.value = parseInt(val1) + parseInt(val2);
}
Michel
Main Topics
Browse All Topics





by: LuxuryYachtPosted on 1999-08-25 at 20:14:50ID: 1291190
Here's an example of how you can do it easily..
e = txt; }
The key is telling the HREF of the anchor tags to run some javascript. You can make them run any function you like obviously.
It works on IE and Scrape 4+
Matt
--
<html>
<head>
<script language="JavaScript">
var txt="Whatever";
function x() { document.formA.Output.valu
function xA() { txt = 'A'; x(); }
function xB() { txt = 'B'; x(); }
function xC() { txt = 'C'; x(); }
function xD() { txt = 'D'; x(); }
</script>
</head>
<body>
<form name="formA">
<Input Type="Button" Name="Test" Value="Test" onClick="xA()">
<Input Type="TextArea" Name="Output">
</form>
<a href="javascript: xB();"><img src="img1"></a>
<a href="javascript: xC();"><img src="img2"></a>
<a href="javascript: xD();"><img src="img3"></a>
</body>
</html>