JavaScript - Test If The Fields Will Be Completed Submit Will Visible
Hello,
months when I want all the fields will be filled submit will be visible on all but I just do what has not n'arive test Note b: there is already invisible submit send # I hope the idea is clear Maintenon. here is my code jQuery: Code: $(document).ready(function() { //------------------ validation champ email par blur ------------- $("#email,#objet,#message").blur(function() { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ($("#email").val() !== "E-mail" && $("#email").val() !== "" && $("#email").val().match(filter) && $("#objet").val() !== "" && $("#objet").val() !== "Objet" && $("#message").val()!== "" && $("#message").val()!== "Votre message") { $("#objet,#message,#email").css("border-color","#98D100"); $("#envoyer").fadeIn(2000); alert('les champs valid'); return true; } else { $("#objet,#message,#email").css("border-color","#FF0000"); $("#envoyer").fadeOut(2000); alert('les champs not valid'); return false; } }); //--------------- animation de champ message ----------------- $("#message").focus(function(){ $("#message").animate({ height: "50px" }, 1000 ); }); }); here is the html code: Code: <input id="email" type="text" value="E-mail" onFocus="if (this.value=='E-mail') {this.value=''}"/> <div class="cl"></div> <input id="objet" type="text" value="Objet" onFocus="if (this.value=='Objet') {this.value=''}"/> <div class="cl"></div> <textarea id="message" type="text" value="Votre message" onFocus="if(this.value=='Votre message') {this.value=''}">Votre message</textarea> <div class="cl"></div> <input id="envoyer" type="submit" value="Envoyer"/> Regards. Similar TutorialsAm integrating a Barclays epdq shopping cart into an existing website, part of the regulations with this system is that you can only submit from one 'allowed url'. To enable access from multiple url's I need to create a 'jump page'. This needs to be a simple page that takes any variables posted to it and re-posts them (onload) onto the epdq shopping cart. The problem is I am unable to populate the form dynamically and submit onload. I have tested and it all works fine if hardcoded. Is it possible to submit a dynamically generated form using javascript? PHP Code: foreach ($_POST as $name => $value){ $newVars .= '<INPUT value="' . $value . '" name="' . $name .'" type="hidden" />'; } Code: <html> <head></head> <body onLoad="document.epdqformer.submit();"> <FORM name="epdqformer" id="epdqformer" action="https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdq.e" method="POST"> PHP Code: I'm trying to understand how forms, data, php, javascript all work together. So 1) I hardcoded some html form fields with values using php using "echo", then 2) I dynamically created some more html form fields with values using javascript using "createElement" and appending to the html form element. When I click on the submit form, the php created form fields still show on the webpage, but the javascript dynamically created form fields disappear. Can anyone shed some light for me? Why are the javascript created form fields disappearing when I click on submit and not the PHP created form fields? Thank you! Code: <form method="post" id="commentform" action="<?php echo $PHP_SELF?>"> This is my first post and hope someone can show me how to have JavaScript wait until a function has completed before moving on? I tried a timer, but the database does not always came back with data durning the time alloted. Thank you for any help. Code: function RunMerch() //Reprompt script { var fW = (typeof getFormWarpRequest == 'function' ? getFormWarpRequest() : document.forms['formWarpRequest']); if ( !fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );} //fW._oLstChoicesMyFieldName.selectedIndex = 0; var preFix = ''; if (fW.elements['cv.id']) { preFix = fW.elements['cv.id'].value; } setTimeout('oCV' + preFix + '.promptAction(\'reprompt\')', 1000); { //Call val () function -- This is where I want it to complete the reprompt function before moving on val(); } } // This will run the valtradselection() function function val() { valtradselection(); } I type something on the current textarea/input and all the values get removed after I add another field. Is there a solution? Code: <script language="Javascript" type="text/javascript"> <!-- //Add more fields dynamically. function addField(area,field,limit) { if(!document.getElementById) return; //Prevent older browsers from getting any further. var field_area = document.getElementById(area); var all_inputs = field_area.getElementsByTagName("input"); //Get all the input fields in the given area. //Find the count of the last element of the list. It will be in the format '<field><number>'. If the // field given in the argument is 'friend_' the last id will be 'friend_4'. var last_item = all_inputs.length - 1; var last = all_inputs[last_item].id; var count = Number(last.split("_")[1]) + 1; //If the maximum number of elements have been reached, exit the function. // If the given limit is lower than 0, infinite number of fields can be created. if(count > limit && limit > 0) return; //Older Method field_area.innerHTML += "<li><textarea id='steps' name='steps[]' rows='5' cols='40'></textarea><br /><input id='steps_image' name='steps_image[]' /></li>"; } //--> </script> <ol id="steps_area"><li> <textarea id='steps' name='steps[]' rows='5' cols='40'></textarea><br /><input id='steps_image' name='steps_image[]' /> </li> </ol> <input type="button" value="Add" onclick="addField('steps_area','',15);"/> The page loads and existing data is put in their correct fields. When I click 'add more' to add more fields to the form it does so and I am able to add new data. If on adding a new fields and its data I click 'add more' again it clears out the recently added data from the fields. The existing data that was present when the page first loaded is still their but all the new fields added data is cleared. how can I get it so the data stays, like in phpmyadmin when adding new fields. JS Code: function addmore(addwhat) { // count existing boxes to find out next number to use. // ? if (addwhat == 'addresses') { fieldid = 'addressesdiv'; } if (addwhat == 'namesnumbers') { fieldid = 'namesdiv'; } var dv = document.getElementById(fieldid).innerHTML; var lines = dv.match(/<br>/ig).length; if (addwhat == 'addresses') { document.getElementById('addressesdiv').innerHTML += '<textarea name="address' + lines + '" cols="30" rows="2"></textarea><br>'; } if (addwhat == 'namesnumbers') { document.getElementById('namesdiv').innerHTML += '<textarea name="name' + lines + '" cols="30" rows="2"></textarea><br>'; document.getElementById('mobilesdiv').innerHTML += '<textarea name="mobile' + lines + '" cols="30" rows="2"></textarea><br>'; } } PHP Code: <? if ($_POST['Submit'] == 'Submit') { echo("sent<br>"); for ($c = 1; $c <= (count($_POST)-1)/2; $c++) { echo("name" . $c . " = " . $_POST['name'.$c] ." mobile" . $c . " = " . $_POST['mobile'.$c] . "<br>"); } } $customer_id = "11"; // get existing data. // if not yet sent get data from databases $ok = "no"; if ($_POST['Submit'] != "Submit") { echo("<br>not sent<br>"); $res = db_query("SELECT * FROM `customer_client_names` WHERE `customer_id` = '". $customer_id ."'"); $maincount = mysql_num_rows($res); echo("<br>number of clients = ".$maincount."<br>"); for ($c = 1; $c <= $maincount; $c++) { $_POST['name'.$c] = mysql_result($res, $c-1, "client_name"); $_POST['mobile'.$c] = mysql_result($res, $c-1, "client_mobile"); echo("cn = ".$_POST['name'.$c] . " cm = ".$_POST['mobile'.$c] . "<br>"); } } else { // display last posted info echo("<br>sent<br>"); $ok = "yes"; // check if info was entrted correctly or not. for ($c = 1; $c <= ((count($_POST)-1)/2); $c++) { if ($_POST['name'.$c] != "" && $_POST['mobile'.$c] == "") { echo("<br>" . $_POST['name'.$c] ." was not given a mobile number<br>"); $ok = "no"; $maincount ++; } if ($_POST['name'.$c] == "" && $_POST['mobile'.$c] != "") { echo("<br>" . $_POST['mobile'.$c] ." mobile was not given a name<br>"); $ok = "no"; $maincount ++; } } } if ($ok == "no") { ?> <form name="form1" method="post" action="?ac=<?=$menu_item;?><? echo("&phpsession=" . $phpsession); ?>"> <div style="width: 850px;"> <div id="namesdiv" style="float: left; padding-right: 10px;">Client's Names<br> <? for ($c = 1; $c <= ((count($_POST)-1)/2)+1; $c++) { if ($_POST['name'.$c] != "" || $_POST['mobile'.$c] != "") { ?> <textarea name="<?='name'.$c;?>" cols="30" rows="2"><?=$_POST['name'.$c];?></textarea><br> <? } } ?> </div> <div id="mobilesdiv" style="float: left;">Client's Mobile numbers<br> <? for ($c = 1; $c <= ((count($_POST)-1)/2)+1; $c++) { if ($_POST['name'.$c] != "" || $_POST['mobile'.$c] != "") { ?> <textarea name="<?='mobile'.$c;?>" cols="30" rows="2"><?=$_POST['mobile'.$c];?></textarea><br> <? } } ?> </div> </div> <br style="clear: both;"> <a href="#" onClick="javascript:addmore('namesnumbers'); return false;" >Add more</a> <input type="hidden" name="customer_id" value="<?=$customer_id;?>"> <input type="submit" name="Submit" value="Submit"> </form> <? } ?> Hello, I am having the problem that a javascript code runs from the start (Since I open the page). My page works by divs and not web pages so they change by the div visibility. This is the code for the divs: Code: function toggleVisibility(selectedTab) { // Get a list of your content divs var content = document.getElementsByClassName('content'); // Loop through, hiding non-selected divs, and showing selected div for(var i=0; i<content.length; i++) { if(content[i].id == selectedTab) { content[i].style.display = 'block'; } else { content[i].style.display = 'none'; } } } So each DIV has a function to make it visible by posting: "toggleVisibility(div);" I am trying to run a javascript code inside this function so that when a certain div becomes available the javascript code autoruns but whenever I post the javascript code inside the function it ignoresthat and runs since the web page loads. My example code would be: Code: function div(){ toggleVisibility('div2'); "RUN JAVASCRIPT CODE HERE" } Please help Reply With Quote 01-22-2015, 09:42 AM #2 felgall View Profile View Forum Posts Visit Homepage Master Coder Join Date Sep 2005 Location Sydney, Australia Posts 6,745 Thanks 0 Thanked 666 Times in 655 Posts Stick the code to run when a div becomes visible in a separate function. If the code is different for different divs then create separate functions. Let's assume that the function containing the code to run when div2 is visible is called func2. Let's also add func1 for when div1 is visible so you can see how it works for different functions for different divs. We'll also assume div3 can use the same function as div1 so you can see how functions can be shared We then amend the toggle function slightly as follows: Code: function toggleVisibility(selectedTab, func) { // Get a list of your content divs var content = document.getElementsByClassName('content'); // Loop through, hiding non-selected divs, and showing selected div for(var i=0; i<content.length; i++) { if(content[i].id == selectedTab) { content[i].style.display = 'block'; func(selectedTab); } else { content[i].style.display = 'none'; } } } Your code to call the toggle now gets changed to: Code: function func1(selectedTab) { "RUN JAVASCRIPT CODE FOR WHEN selectedTab IS MADE VISIBLE HERE" } function func2() { "RUN JAVASCRIPT CODE FOR WHEN div2 IS MADE VISIBLE HERE" } function div(){ toggleVisibility('div2', func2); toggleVisibility('div1', func1); toggleVisibility('div3', func1); } I have seveal flash quizzes set up for my history class. On the main page right now is just a link to quiz #1. After finishing quiz #1, I want a cookie set that is proof of a finished test. I will then redirect back to the main page that will now show a link to quiz #2. And so on after each quiz.... Any help would be greatly, greatly appreciated. I want 10 divs that have their visibility set to none. Then based on a cookie I would like to have 1 at at time become visible. Say I have a gallery of 16 images and I have a menu for the gallery to sort the images by Most Viewed, Most Recent, Highest Rating, A-Z, Z-A.. if I were to click 1 of the menu links it will change the order of the images but is it possible to actually show the images MOVING into their new places? Looking for a jquery solution if possible.. if not still open to anythin that would work Hi, After much searching and head-scratching (JS is not my forte!), I adapted some code to do what I want - well, almost! So here I am back again. I need to have three divs on a page, with each separate div changing onClick. Below is the code so far. Two problems: 1) when I open it in a browser window both divs show, then the one disappears when I click on the second div leaving only the numbers. How can I change it so that both divs remain open? 2) Instead of the numbers [1], [2], etc. to change the divs, I'd like to have to just click on one single 'click here for more' to display the next div then return to the first after the last one. Can this be integrated or is it too late? Thank you! Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <title>Switching Divs</title> <style> #one {width: 500px; height: 100 px; border: 1px solid red; } #two {width: 500px; height: 100px; border: 1px solid blue; } #three {width: 500px; height: 100px; border: 1px solid purple; } #four {width: 500px; height: 100px; border: 1px solid green; } #five {width: 500px; height: 100 px; border: 1px solid red; } #six {width: 500px; height: 100px; border: 1px solid blue; } #seven {width: 500px; height: 100px; border: 1px solid purple; } #eight {width: 500px; height: 100px; border: 1px solid green; } #propertyfrance {float: left; color: #666666; font-family: tahoma arial, verdana, sans-serif; font-size: 11px; } .propertytext {float: left; clear: right; width: 300px; height: 100px; border: 1px solid #000; } .propertyphoto {float: left; width 200px; height: 100px; border: 1px solid #cceeff; text-align: center; } #image-switch #one { padding:0px; } #image-switch #two, #image-switch #three, #image-switch #four { display:none; } #image-switch #five { padding: 0px; } #image-switch #six, #image-switch #seven, #image-switch #eight { display:none; } </style> <script type="text/javascript"> function switch1(div) { if (document.getElementById('one')) { var option=['one','two','three','four', 'five', 'six', 'seven', 'eight']; for(var i=0; i<option.length; i++) { obj=document.getElementById(option[i]); obj.style.display=(option[i]==div)? "block" : "none"; } } } </script> </head> <body> <h4>Switching divs (javascript)</h4> <div id="image-switch"> <br>OnClick <br> <div id="one"> <div class="propertytext">We'll get some text in here for property 1</div> <div class="propertyphoto"><img src="property1.jpg" height="100" width="180" alt="Property 1"></div> </div> <div id="two"> <div class="propertytext">We'll get some text in here for property 2</div> <div class="propertyphoto"><img src="property2.jpg" height="100" width="180" alt="Property 2"></div> </div> <div id="three"> <div class="propertytext">We'll get some text in here for property 3</div> <div class="propertyphoto"><img src="property3.jpg" height="100" width="180" alt="Property 3"></div> </div> <div id="four"> <div class="propertytext">We'll get some text in here for property 4</div> <div class="propertyphoto"><img src="property4.jpg" height="100" width="180" alt="Property 4"></div> </div> <br> <a onClick="switch1('one');"> [1]</a> <a onClick="switch1('two');"> [2]</a> <a onClick="switch1('three');"> [3]</a> <a onClick="switch1('four');"> [4]</a> <br><br> <div id="five"> <div class="propertytext">We'll get some text in here for property 5</div> <div class="propertyphoto"><img src="property5.jpg" height="100" width="180" alt="Property 5"></div> </div> <div id="six"> <div class="propertytext">We'll get some text in here for property 6</div> <div class="propertyphoto"><img src="property6.jpg" height="100" width="180" alt="Property 6"></div> </div> <div id="seven"> <div class="propertytext">We'll get some text in here for property 7</div> <div class="propertyphoto"><img src="property7.jpg" height="100" width="180" alt="Property 7"></div> </div> <div id="eight"> <div class="propertytext">We'll get some text in here for property 8</div> <div class="propertyphoto"><img src="property6.jpg" height="100" width="180" alt="Property 8"></div> </div> <br> <a onClick="switch1('five');"> [5] </a> <a onClick="switch1('six');"> [6] </a> <a onClick="switch1('seven');"> [7] </a> <a onClick="switch1('eight');"> [8] </a> </div> </body> </html> If you goto http://jsfiddle.net/BT4Bk/ you can see that the dark bar is visible. This is padding for the #ajax div that will wrap the content inside. How do I hide the padding so its not displayed until it slides into view with the content? hy. i have menu further construction Code: <ul id="menu" class="menu"> <li><a href="#">item 1  </a></li> <li><a href="#">item 2  </a></li> <li><a href="#">item 3</a> <ul id="submenu" class="submenu"> <li><a href="#">item 3 sub 1</a></li> <li><a href="#">item 3 sub 2</a></li> </ul> </li> </ul> and my function to open my on obscure menu then mouse over to element teg a Code: function doMenu (li){ var oli = li.childNodes; var len = oli.length; if (len > 1) { for (var i = 0; i < len; i++) { if (oli[i].nodeType == 1) { if (oli[i].tagName == 'UL') { return oli[i]; }}}} }; function doShow(e) { if (e) { var t = e.target; console.log(t.tagName); var pN = t.parentNode; console.log(pN) if (pN.tagName == 'LI') { if (doMenu(pN)) { var oUl = doMenu(pN); if (oUl.style.display == "none") { oUl.style.display = "block" } else {oUl.style.display = "none"} }}}}; and my problem, then HTML page load full. I mouse over to element tag a and function at this moment not show element menu. why it so. Because then i start mouse over too, function start and menu show. who can explain me how it work. Hi - I hope someone can help me out, I've pored over this problem for hours. The site is http://www.spacemodel.com. A doctype is set. The CSS for the navmenu is: Code: #menu { background:#262626 url(images/menu_bg.gif) repeat-x top; border-bottom:1px solid #230808; margin:0 20px; height: 49px; overflow: hidden; } #menu .mleft{background: url(images/menu_side.gif) no-repeat left; width: 100%; height: 100%;} #menu .mright{background: url(images/menu_side.gif) no-repeat right; width: 100%; height: 100%;} #menu ul { width:960px; height:100%; overflow:hidden; } #menu ul li { list-style:none; font-family:Arial, sans-serif; font-weight: 700; line-height: 49px; color:#E6E6E6; font-size:11px; text-transform:uppercase; text-align:center; background:url(images/menu_side.gif) no-repeat right 0; margin:0 0 0 25px; padding: 0 25px 0 0; } #menu a:link,#menu a:visited,#menu a:active,#menu a:hover { color:#E6E6E6; text-decoration:none; } Works fine in all other browsers and versions. Affects about 5% of visitors, but one is my client All help and insight appreciated! Laurie Hi, I have a form that when you click submit gives a warning box asking if to continue code below Now when I type in the text field and press enter it doesn't submit nor does it pop up the warning box, how would I do this Code for submit button Code: <script LANGUAGE="JavaScript"> <!-- function submitMyForm() { var agree=confirm("ARE YOU SURE ?"); if (agree) return true ; else return false ; } // --> </script> Code: <form action="admin-delete.php" method="post" name="cp_delete" id="cp_delete"> <input type="text" name="cp_delete_bg" id="cp_delete_bg"> <input type="submit" name="submit" value="submit" onclick="return submitMyForm()"/> </form> Hello guys, The following excerpt is part of a very huge project(in terms of code involved). Pardon me if it lacks a bit of context. But I assume I have posted adequate information for understanding the problem. Code: var sztitlebar_specific= "<table cellpadding='0px' cellspacing='0px' width='100%'><tr>" +"<td class='tiletitle'>" "<img src='../images/alert.gif' onclick='toggleAlerts(\"#ID#\")' alt='Toggle Alerts' title='Toggle Alerts' style='cursor: hand'>" + "<input type='checkbox' name='pricesonlycb' onclick='parent.applyFilterPricesOnly(\"#ID#\",pricesonlycb.checked,mypricesonlycb.checked,\"#NAME#\")'>" + "<input type='checkbox' name='mypricesonlycb' onclick='parent.applyFilterPricesOnly(\"#ID#\",pricesonlycb.checked,mypricesonlycb.checked,\"#NAME#\")'>" + "<td class='tiletitle' style='text-align: center'>#NAME#</td>" + </tr></table>"; The onclick event fires without any trouble, and the following function is called. Code: function applyFilterPricesOnly(filterid, pricesonly, mypricesonly,filtername){ alert("applyFilterPricesOnly called: filterid =" + filterid + "filtername =" + filtername + "mypricesonly =" + mypricesonly + " pricesonly=" + pricesonly); } But when I alert the status of the checkboxes they show up as "undefined". As you can see, the first piece of code defines a titlebar with a button and a couple of checkboxes and the name of the titlebar. And it is these checkboxes that remain undefined even though I can see them and check and uncheck them. But the name of the titlebar gets passed to the function correctly when the onclick event fires and it gets alerted. Where am I going wrong? Hi As title says : "How to hide div so his content won't be loaded until he is visible?" And is it possible to add preloader for that div? Hi, have table with 5 rows. First 2 rows visible. Last 3 rows hidden - Code: <tr id="row1" style="display: none"> <tr id="row2" style="display: none"> <tr id="row3" style="display: none"> With onclick would like to make those rows visible to user - how can I do that? thank - john Hello everyone, I have tried about 8 different variations of code to try to get this to work properly and cannot accomplish it. Please help if you can figure it out. I have 2 div's that are hidden. each div contains a FLV video, autostart=false. when button 1 is clicked, DIV 1 becomes visible and you may click on video to start playing it. When button 2 is clicked, DIV 1 goes to hidden and DIV 2 becomes visible with video 2. -- Ok so problem is this, the video that was playing in DIV 1 remains playing or at least the audio remains playing. If video 2 is started then you have 1 video source and 2 audio sources playing. I am trying to get the video in DIV 1 or DIV 2 to STOP or PAUSE when the DIV's state becomes hidden. here is the last code I tried below before frustration over come me. any suggestions would be great. Robert Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- #Layer1 { position:absolute; width:200px; height:115px; z-index:1; left: 13px; top: 47px; visibility: hidden; } #Layer2 { position:absolute; width:600px; height:645px; z-index:2; left: 14px; top: 47px; visibility: hidden; } --> </style> <script type="text/JavaScript"> <!-- 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_showHideLayers() { //v6.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; } obj.visibility=v;} } function MM_popupMsg(msg) { //v1.0 alert(msg); } //--> </script> </head> <img src="chastain cd landing pages/atlanta-ga-carpet-upholstery-cleaning.com/images/phone.jpg" alt="Button to Display DIV 1" width="27" height="22" onclick="MM_showHideLayers('Layer1','','show','Layer2','','hide')" /> <img src="chastain cd landing pages/atlanta-ga-carpet-upholstery-cleaning.com/images/spacer.gif" width="60" height="1" /> <img src="chastain cd landing pages/atlanta-ga-carpet-upholstery-cleaning.com/images/phone.jpg" alt="Button to Display Div 2" width="27" height="22" onclick="MM_showHideLayers('Layer1','','hide','Layer2','','show')"/> <div id="Layer1">VIDEO 1 <object id="player1" type="application/x-shockwave-flash" width="600" height="600" wmode="transparent" data="http://www.dryconcepts.com/videos/flvplayer.swf?file=http://www.dryconcepts.com/videos/video1.flv&autoStart=false"> <param name="movie" value="http://www.dryconcepts.com/videos/flvplayer.swf?file=http://www.dryconcepts.com/videos/video1.flv&autoStart=false" /> <param name="wmode" value="transparent" /> </object> </div> <div id="Layer2">VIDEO 2 <object id="player2" type="application/x-shockwave-flash" width="600" height="600" wmode="transparent" data="http://www.dryconcepts.com/videos/flvplayer.swf?file=http://www.dryconcepts.com/videos/video1.flv&autoStart=false"> <param name="movie" value="http://www.dryconcepts.com/videos/flvplayer.swf?file=http://www.dryconcepts.com/videos/video1.flv&autoStart=false" /> <param name="wmode" value="transparent" /> </object> </div> </body> </html> Hi I'm trying to create a questionnaire style series of radio buttons which are hidden and then a different set of radio buttons displayed depending on the previous answer. eg Q1 Is it a man? (if select yes then display) Q2 Is he called John? (if no then display) Q3 Is he called Gary? and so on... I've been testing using the code below but wondered if anyone had any ideas on how this could be done easily? Be grateful for any advice, Matt. Code: Is it a Man? <input type="radio" name="agree" value="y" onClick="toggle(this)" /> Yes <input type="radio" name="agree" value="n" onClick="toggle(this)" /> No <br /> <p id="continue"> <input type="radio" name="agree" value="y" onClick="toggle(this)" /> Yes <input type="radio" name="agree" value="n" onClick="toggle(this)" /> No </p> <script> var continue_button = document.getElementById('continue'); continue_button.style.visibility = 'hidden'; function toggle(switchElement) { if (switchElement.value == 'y') continue_button.style.visibility = 'visible'; else continue_button.style.visibility = 'hidden'; } </script> Hi all Is using the real form submit button a problem in any way? Can it actaully send a form when a person uses 'enter' in a text field. When I use this submit, it triggers my validation which is great. Code: <input type="submit" value="OnSubmit validate" /> However this way doesn't seem to trigger my validation although It may solve the above form send problem (if that realy exists). How do I get it to act the same as real submit so it will trigger validation like onsubmit above? Code: <input type="button" value="Send Feedback" onclick="this.form.submit()" /> LT does any of that make sense? all ideas helpful and appreciated |