PDA

View Full Version : Onclick help needed!



2bad
04-15-2007, 04:26 PM
I'm hoping someone can help me - here's my webpage I'm working on:

http://www.vendorman.net/vmacredit/register.html

When the user selects: Individual Owner, the page should forward to https://www.3579.net/secure/vma/form_ind.html

When the user selects: Management Company, the page should forward to https://www.3579.net/secure/vma/form_man.html

The problem is that regardless of what the user selects, it always goes to the Individual Owner page. I can't get it to work even when the user actually SELECTS Management Company. I'm sure it's my coding that's messed up. Here's my coding in that section:

</p><form method="post" name="frm" action="">
<blockquote>
<table border="0" cellpadding="0" cellspacing="2">
<tbody><tr>
<td><input value="1" name="select" id="select" type="radio"></td>
<td><b>Individual Owner</b>&nbsp;</td>
<td>
<img src="../images/icon_info1.gif" class="LEVEL1" id="OUT1i" border="0" width="10" height="10"></td>
<td class="smallprint"><a class="LEVEL1" id="OUT1t" style="text-decoration: none; color: rgb(0, 0, 255);">Explain</a></td>
</tr>
</tbody></table>
<table style="display: none;" id="OUT1s">
<tbody><tr>
<td>
<!-- start hidden content -->
<p class="smallprint">You are the actual owner of the rental
property(ies). If you are the owner of the property(ies) but you have
set up a management company to manage your own properties (i.e., you
have created a corporation or LLC), and that entity manages the
properties, then you would sign up as a management company.</p> </td>
</tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="2">
<tbody><tr>
<td><input value="2" name="select" id="select" checked="checked" type="radio"></td>
<td><b>Management Company</b>&nbsp;</td>
<td>
<img src="../images/icon_info1.gif" class="LEVEL1" id="OUT2i" border="0" width="10" height="10"></td>
<td class="smallprint"><a class="LEVEL1" id="OUT2t" style="text-decoration: none; color: rgb(0, 0, 255);">Explain</a></td>
</tr>
</tbody></table>
<table style="display: none;" id="OUT2s">
<tbody><tr>
<td>
<!-- start hidden content -->
<p class="smallprint">You are a company (corporation or LLC) that
manages or rents rental properties for other people or companies. Real
Estate agents also qualify under this category.</p> </td>
</tr>
</tbody></table>
<table style="display: none;" id="OUT3s">
<tbody><tr>
<td>
<!-- start hidden content -->
<p class="smallprint">You would like debt collection services only. You
may add credit report capability later. This option allows instant
sign-up with VMACredit.</p> </td>
</tr>
</tbody></table>
<p><input value="Start Now!" type="button" onClick="javascript:if(document.getElementById('se lect').value==1){document.frm.action='https://www.3579.net/secure/vma/form_ind.html';}else{document.frm.action='https://www.3579.net/secure/vma/form_man.html';}document.frm.submit();"></p>
</blockquote>
</form>
<br></td>
</tr>
</tbody></table> </td>
</tr>
</tbody></table> </td>
</tr>
<tr>
<td width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
</tr>
<tr>
<td bgcolor="#ffcc66" width="100%"><img src="http://www.vendorman.net/images/fill.gif" border="0" height="5" width="700"></td>
</tr>
<tr>
<td width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
</tr>
<tr>
<td bgcolor="#000000" width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
</tbody></table>
</center>
<script language="javascript" src="images/referdetect.htm"></script>
<script language="JavaScript">
var img1 = new Image();
img1.src = "images/icon_info1.gif";
var img2 = new Image();
img2.src = "images/icon_info2.gif";
function doOutline() {
var srcId, srcElement, targetElement;
srcElement = window.event.srcElement;
if (srcElement.className.toUpperCase() == "LEVEL1" ||
srcElement.className.toUpperCase() == "FAQ") {
srcID = srcElement.id.substr(0, srcElement.id.length-1);
targetElement = document.all(srcID + "s");
srcElement = document.all(srcID + "i");

if (targetElement.style.display == "none") {
targetElement.style.display = "";
if (srcElement.className == "LEVEL1")
srcElement.src = img2.src;
} else {
targetElement.style.display = "none";
if (srcElement.className == "LEVEL1") srcElement.src = img1.src;
}
}
}
document.onclick = doOutline;
</script>
</body></html>

****************************************
So if you can tell me where my coding is messed up, please do. I'm trying to find out how to make the page forward to the Management page when the radio button is put in that section. Please help if you can!!

Thanks,

VatsaL
04-15-2007, 05:11 PM
I haven't looked at you code, but here s a quick example which might help you recode

http://www.b3ta.cr3ation.co.uk/data/htm/radioselect.htm

good luck.

Twey
04-15-2007, 06:10 PM
That code's vastly overcomplicated, and uses several very poor practices (eval() is very rarely necessary). A nicer way of doing it is something like this:
<script type="text/javascript" src="http://www.twey.co.uk/pythonic.js"></script>
<script type="text/javascript">
Twey.Pythonic.LOAD("Array.filter");
var actions = {
'google' : "http://www.google.com/",
'yahoo' : "http://www.yahoo.com/"
};
</script>
<form action="redirect.php" onsubmit="return (this.action = actions[Array.prototype.slice.call(this.elements['destinations']).filter('checked')[0].value]);">
<div>
<label>
<input type="radio" value="google" name="destinations"> Google
</label>
<label>
<input type="radio" value="yahoo" name="destinations"> Yahoo
</label>
<input type="submit" value="Go">
</div>
</form>

mburt
04-15-2007, 08:00 PM
Won't work in IE. You have to specify the same name attribute for the to checkboxes.

mburt
04-15-2007, 08:20 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript">
var actions = {
'google' : "http://www.google.com/",
'yahoo' : "http://www.yahoo.com/"
};
function send(el) {
var obj = el;
for (var i=0;i<obj.elements.length;i++)
if (obj.elements[i].checked) return actions[obj.elements[i].value]
};
</script>
<form action="" onsubmit="return (this.action = send(this));">
<input type="radio" value="google" name="foo"> Google
<input type="radio" value="yahoo" name="foo"> Yahoo
<input type="submit" value="Submit">
</form>

Twey
04-15-2007, 08:54 PM
Oh, yes, sorry, that's not just an IE thing. Edited.

But what's the Transitional DOCTYPE for? :-\

2bad
04-16-2007, 12:43 AM
However, I'm trying to keep the coding intact and just fix the part that is causing it to NOT forward to the proper URL. I understand that my script is completely overly complicated but if you could help me just to tell me what part I need to fix so that it works, it would be most appreciated.

Thanks,

Twey
04-16-2007, 08:30 PM
Not just overly complicated, it's poorly written. You'll have a lot more luck adjusting that one to suit your page.