User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 363,557 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,905 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1908 | Replies: 0
Reply
Join Date: Apr 2005
Posts: 2
Reputation: kah22 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kah22 kah22 is offline Offline
Newbie Poster

Forms Not Returning Correct Information

  #1  
Apr 5th, 2005
I'm desperately trying to finish of a site for my writers club and I know nothing about programing only got as far as I have care of WYSIWYG program.

Anyway I want to insert a series of forms in one of the pages giving random Male Names, Female Names, Places, Events. With a little help I designed a form which let me pick random first names. I called this form 'Form1.' I then thought if I duplicated that form that I could just change the Male Names to Female Names - why was I so stupid - both boxes showed Female Names. When I tried it with places all forms showed places.

Anyway I'm not a programer, all I'm interested in doing is putting this particular bit of our site together. I really would appreciate some help. I'm using Dreamweaver MX

Here is what I have so far.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<body bgcolor="#FFFFFF" onLoad="MM_preloadImages('../network%20images/about_f2.gif','../network%20images/marketing_f2.gif','../network%20images/comp_f2.gif','../network%20images/library_f2.gif','../network%20images/try_f2.gif','../network%20images/contacts_f2.gif')">
<div id="Layer3" style="position:absolute; left:10px; top:78px; width:200px; height:160px; z-index:3">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="Form1" method="get" action="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
fnames=["male1","male2","male3","male4","male5","male6"];
function getRandomFromArrays(){var a=arguments,aa=a.length,tmp=[];
while(aa--){
tmp.push(a[aa][new Date()%a[aa].length])
}
return tmp.reverse();
}
function populateFields(f1,a1){
f1.value=getRandomFromArrays(a1)[0];
}

</script></head>
<body> <Place action="" method="get" name="f">
<p>
<input name="first" type="text">
<p>
<input name="btn" type="button" value="Click" onClick="populateFields(first,fnames)">
</form>
&nbsp;</td>
</tr>
<tr>
<td><form name="Form2" method="get" action="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/JavaScript">
fnames=["female1","female2","female3","female4","female5","female6"];
function getRandomFromArrays(){var a=arguments,aa=a.length,tmp=[];
while(aa--){
tmp.push(a[aa][new Date()%a[aa].length])
}
return tmp.reverse();
}
function populateFields(f1,a1){
f1.value=getRandomFromArrays(a1)[0];
}

</script></head>
<body> <Place action="" method="get" name="f">
<p>
<input name="first" type="text">
<p>
<input name="btn" type="button" value="Click" onClick="populateFields(first,fnames)">
</form>
&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>

Any help would be appreciated
Kevin
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC