JavaScript - Var In A Webpage(html Form Textarea Value - Yui) That Contains Html Code, And Want To
If I have a javascript var in a webpage(html form textarea VALUE - yui) that contains html code, and want to appear it, in confirmformpage.php, then how to transfer it...? is it really needed go via PHP ...? and ofcourse use innerHTML to write it....yes
I usually use an intermitened processform.php script. http://developer.yahoo.com/yui/editor Similar TutorialsI've done a bit of searching and I can't find the answer to my question. I'm working on a website for my business. I have some basic knowledge of coding but I'm mostly a code cobbler. I find various pieces and put it together and hope it works so take it easy on me. I have some code to display products on my site. It works fine. We just have a lot of products and for me to add each one by hand was getting ridiculous. I finally had the bright idea to use Javascript to generate the code for me and then copy it back into my actual HTML page. Last night I wrote the code below. It works perfectly except I have to constantly "View Source" in order to get the code. I was hoping to cut down on a step or two and have the code go into a TextArea. From there I can just select it and copy it into the HTML file. It should make things a little quicker and most importantly easier. Maybe after that I'll try to figure out how to write function to select everything in the TextArea and copy it to my clipboard. That would make things even faster. Any help? 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> <SCRIPT LANGUAGE="JavaScript"> function calc (form) { var images = form.images.value; var imagesArray = images.split("\n"); var linebreak = "<br />"; var i=0; var j=0; var a=0; while(i < imagesArray.length) { if(j==0) { document.write (" <!-- -------------------------------------------- -->\n"); document.write (" <div id=\"cols3-top\"></div>\n"); document.write (" <div id=\"cols3\" class=\"box\">\n"); } a++; if(j/2!=1) { if(a==imagesArray.length) { document.write ("\n <!-- ---------------- -->\n\n"); document.write (" <div class=\"col last\">\n"); document.write (" <h3>Header</h3>\n"); document.write (" <p class=\"nom t-center\">\n"); document.write (" <a href=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" class=\"nivoZoom center\"><img src=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" alt=\"" + imagesArray[i] +"\" height=\"200px\" /></a></p>"); document.write (" <!-- /col-text -->\n"); document.write (" <div class=\"col-itemnum\">PDU: " + imagesArray[i] + "</div>\n"); document.write (" </div>\n"); document.write (" <!-- /col -->\n"); document.write (" <hr class=\"noscreen\" />\n"); document.write (" </div>\n"); document.write (" <div id=\"cols3-bottom\"></div>\n"); document.write (" <!-- /Columns End Here -->\n\n\n"); break; } else { document.write ("\n <!-- ---------------- -->\n"); document.write (" <div class=\"col\">\n"); document.write (" <h3>Header</h3>\n"); document.write (" <p class=\"nom t-center\">\n"); document.write (" <a href=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" class=\"nivoZoom center\"><img src=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" alt=\"" + imagesArray[i] +"\" height=\"200px\" /></a></p>"); document.write (" <!-- /col-text -->\n"); document.write (" <div class=\"col-itemnum\">PDU: " + imagesArray[i] + "</div>\n"); document.write (" </div>\n"); document.write (" <!-- /col -->\n"); document.write (" <hr class=\"noscreen\" />\n"); i++; j++; } } else { document.write ("\n <!-- ---------------- -->\n\n"); document.write (" <div class=\"col last\">\n"); document.write (" <h3>Header</h3>\n"); document.write (" <p class=\"nom t-center\">\n"); document.write (" <a href=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" class=\"nivoZoom center\"><img src=\"../../product_imgs/resins/pdu/54xxxgs/" + imagesArray[i] + ".jpg\" alt=\"" + imagesArray[i] +"\" height=\"200px\" /></a></p>"); document.write (" <!-- /col-text -->\n"); document.write (" <div class=\"col-itemnum\">PDU: " + imagesArray[i] + "</div>\n"); document.write (" </div>\n"); document.write (" <!-- /col -->\n"); document.write (" <hr class=\"noscreen\" />\n"); document.write (" </div>\n"); document.write (" <div id=\"cols3-bottom\"></div>\n"); document.write (" <!-- /Columns End Here -->\n\n\n"); i++; j=0; } } document.close(); } </script> </head> <body> <div style="width:960px; margin:0 auto;"> <form name="myform" method="get" action=""> <textarea label="Image Names:"name="images" cols="30" rows="15" onclick="this.value=''" ></textarea> <p> <label> <input type="button" name="calculate" value="Calculate" onClick="calc(this.form)"/> </label> </p> </form> </div> </body> </html> hi, I have some HTML to edit in my database, in my back end administration I have it in a textarea but when I go to edit it, it all messes up and lots of '/' area added, see below: Code: Site Design by: <a href=\\\\\\\"http://www.jbiddulph.com\\\\\\\" target=\\\\\\\"_blank\\\\\\\" title=\\\\\\\"John Biddulph - Web Development\\\\\\\">jbiddulph.com</a> php code Code: <p> <label>Site Design by</label> <textarea class="text-input small-input" name="SiteDesignby"><?php echo $row1['SiteDesignby'] ?></textarea> </p> Can anyone help please? favorite I'd like to modify a form on www.formsite.com (form builder app): username: testuser password: password I would like to use the nicedit.com's inline content editor's js to transform my textarea's into a richtext area. At present the nicedit editor works well in creating the richtextarea. However, the KEY point is that I would like formsite's form to pipe in the the created html and render it with the html component of formsite. Currently, the pipe function in formsite will only put out the html syntax in it's html module. action seen he http://fs8.formsite.com/testform/form1/index.html So this would be: 1. checking out my form on formsite.com 2. the script from nicedit.com is already installed in an html component. 3. changing or telling me the scripts/tags/or whatever for formsite form using formsites form builder (which allows some html/script editing). 4. changed so as to render the rich text entered on page 1 in page 2 instead of the html syntax. Any other solutions using formsite and any other richtextarea solutions would be great too! Hi everyone In the below code i tried to write java scirpt in action attribute of form tag in html . Why i wrote that was i want to get the scirpt variable as a part of the url of the target page . I also tried using the location.href="targetpage?value="+value . But It is not redirecting to targetpage because of the action attribute in the form tag. And if we use location.href without action attribute only that script variable was posted and all other remaining textboxes and other form items are being not posted .. Thats why I wrote the scirpt in action attribute. I want the action attribute to work and also the java script variable to be posted .so i wrote the script tag in action attribute of form tag . I hope u got the Scenario . Please help me to resolve the issue.. Thank in advance .. <!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> </head> <body> <? if($_POST['submit'] ) { $var = $_GET['width'] ; } ?> <form name="form_submit" method="post" action="test2.php?width= '<script type= text/javascript> document.write(num)</script>' " onsubmit="return fun(); "> <script type="text/javascript"> function fun() { width = screen.width; height = screen.height; if (width > 0 && height >0) { window.location.href = "http://localhost/test2.php?width=" + width + "&height=" + height; } else exit(); } </script> <input type="text" name="txt" value="sample text" /> <input type="submit" name="submit" value="submit" /> </form> </body> </html> if I have this inside TD tag Code: a<br>b what should I write instead ??? to reproduce new line in textarea Code: result = result.replace(/<br>/ig,"???") First of all I'm a new user and I'm not a HTML/js expert so I'd be very grateful if someone could help me how to fix the below code in order to be able to expand Menu2 ? Code: <script> function expandCollapselapse(showHide) { var hideShowDiv = document.getElementById(showHide); var label = document.getElementById("expand"); if (hideShowDiv.style.display == 'none') { label.innerHTML = label.innerHTML.replace("[+]", "[-]"); hideShowDiv.style.display = 'block'; } else { label.innerHTML = label.innerHTML.replace("[-]", "[+]"); hideShowDiv.style.display = 'none'; } } </script> <div> <table style="width: 500px;" align="left"> <tr> <td onclick="expandCollapse('showHide');" id="expand"><b>[+] Menu1</b></td> </tr> </table> </div> <br><br> <div id="showHide" style="display: none;"> <table style="width: 500px;" align="left"> <tr> <td>Start Date</td> <td>End Date</td> <td>Amount</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> </table> </div> <br><br> <div> <table style="width: 500px;" align="left"> <tr> <td onclick="expandCollapse('showHide');" id="expand"><b>[+] Menu2</b></td> </tr> </table> </div> <br><br> <div id="showHide" style="display: none;"> <table style="width: 500px;" align="left"> <tr> <td>Start Date</td> <td>End Date</td> <td>Amount</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> <tr> <td>06/05/2013</td> <td>06/05/2013</td> <td>1000</td> </tr> </table> </div> Many thanks for your time and help! Cheers, Hi, I'm just now starting to try to insert some javascript into my html and php code. I'm only used to working with those two markups. I need to try some very simple javascript snippets in some forms I'm making, but am having an issue getting the code to work. When I find these snippets, they are usually in a format like this: Code: <SCRIPT LANGUAGE="JavaScript"> // functions and whatnot here function makeSomethingHappen(field, count, max) { if (something.works > true) field.value = i.will.crap(0, max); else // calculate the remaining characters field.value = max - more.nodoze.caffein; } </script> <center> <form name=sample action=""> <input type="text" name="hours"> onKeyDown="CountLeft(some.js.looking,stuff.here);" onKeyUp="CountLeft(some.more.js.looking,stuff.here);"> </form> I've tried inserting the stuff like the webpages have it listed. I also try inserting everything contained in the <script> tags into the head of the document (or creating a head and putting it in there, since all my stuff is php and html code called to the file with php includes and whatnot). Anyways, I hoping somebody can provide a pointer as to how to use these snippets or how to correctly place things like this. I'm assuming there's a relatively uniform way that people are posting their tiny little js codes and I'm missing some basic knowledge as to how to use it. Any help is greatly appreciated. Hi! I'm start learning javascript and can't solve one problem. I need to case user click first radiobutton browser show him first form ($mat1), else second. For example, I have this php code: PHP Code: $mat1="<span id="form_notes_text">".$saved_info."</span><br>\ <input class=\"form_notes_element\" value="0" type="text" name="name" maxlength="9"><br><br>\ <span id="form_notes_text">".$price_info."</span><br>\ <input class=\"form_notes_element\" type=\"text\" name=\"name2\" maxlength\"9\"><br><br>"; $mat2="<span id="form_notes_text">".$saved_info."</span><br>\ <input class=\"form_notes_element\" value="0" type="text" name="name" maxlength="9"><br><br>\ <span id="form_notes_text">".$price_info."</span><br>\ <input class=\"form_notes_element\" type=\"text\" name=\"name2\" maxlength\"9\"><br><br>"; echo "<span id=\"form_notes_text\">$add_title</span><br> <input class=\"form_notes_element\" type=\"text\" name=\"name\" maxlength=\"30\"><br><br> <span id=\"form_notes_text\">$material_type</span><br> <input type=\"radio\" name=\"type\" value=\"1\" checked onclick=\"document.getElementById('add_form').innerHTML = $mat1\">Value 1<br> <input type=\"radio\" name=\"type\" value=\"2\" onclick=\"document.getElementById('add_form).innerHTML = $mat2\">Value 2<br><br><br>"; But it doesn't work. What am I doing wrong? Hello, I have an html script and a .php script. The .php requests a random word from a table of words in a mysql database. I wrote a html form to display the requested word in a text box. Here is my html file: Code: <html> <body> <script type="text/javascript"> function myfunction() { var xmlhttp; if(window.XMLHttpRequest) { xmlhttp= newHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.myLingo.word.value=xmlhttp.responseText; } } xmlhttp.open("GET", "get_Word.php",true); xmlhttp.send(null); } </script> <form name="myLingo"> <input type="button" name="button" value="New Word" onClick="myFunction();" /> <input type="text" name="word" /> </form> </body> </html> and here is my .php script: Code: <?php $con=mysql_connect('localhost', 'xxxx', 'xxxx'); if (!$con) { die('Could not connect: '.mysql_error()); } mysql_select_db("my_lingo", $con); $sql=mysql_query("SELECT `word` FROM `words` ORDER BY RAND()") or trigger_error('Error: ' .mysql_error()); $word=mysql_fetch_array($sql); echo $word[0]; mysql_close($con); ?> When I run this in Internet Explorer; I get a error that is asking for an object on line 32 which is the line that has my button in the javascript. When i run it in firefox, I don't receive an error, but the page still does nothing. Any suggestions? The main function of the page is that, when I click the button, it's supposed to return me a random word from the .php script Thanks, jcjst21 Basically what I need to do is cause a bit of HTML to only display on a specific page. I have figured out how to do most of the work i.e. figuring out what page that the code is being displayed on, etc. However, for some reason the DOM element that I am using will not update based on the Javascript. I have searched the Internet for a solution and unfortunately I have found none. Here is the version of the code that I am currently working on: Code: <html> <head> <script type="text/javascript"> window.onload = function DisplayButton() { var DesiredPage = 'Page to Display'; //Page that I want the code to display on var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); //This determines and places in a variable what page that the code will be on if (sPage == DesiredPage) { document.getElementById('HiddenCode').style.display = "block"; } } </script> <p Id="HiddenCode" style="display:none">Code only to be displayed on indicated page</p> </head> </html> I am somewhat new to Javascript so I feel like I might be missing something obvious here. Thank You to anyone who can help. Zbot I have some HTML that I want to put in a Javascript file and reference the HTML through external Javascript file. So I have my page, example.html Code: <html> <head></head> <body> <script type="text/javascript src="../js/external.js"> </script> </body> </html> external.js Code: document.write("<p class="txt_medium style4"> example.com<br />101 Street St.<br />City, ST, ZIP</p><p class="txt_medium style4">"The Best website." </p>"); The above code is all on one line, but is not displaying on the page. PHP is out of the question too (_._) Any thoughts? Hi i have a problem, i've been trying to fix this for the whole day pls see my code below Code: for ($o = 0; $o <= $totalclass; $o++) { for($i = 1; $i <= 45; $i++) { if ($_SESSION['classification'][$o] == $i) { $sql2="SELECT ClassDesc FROM tblclass WHERE ClassID = '$i'"; $result2=mysql_query($sql2); // If successfully queried if($result2) { while ($row2 = mysql_fetch_assoc($result2)) { $ClassDesc2 = $row2['ClassDesc']; } } //echo $ClassDesc2; ?> <tr> <td bgcolor="FAFAF6" class="small" valign="top">Class <? echo $i; ?></td> <input type="hidden" name="<? echo "classid[]"; ?>" value="<? echo $i; ?>"> <td bgcolor="FAFAF6"> <textarea name="<? echo "specification[]"; ?>" COLS="50" ROWS="6" class="small" wrap="virtual" tabindex="<? echo $i; ?>"><? echo $ClassDesc2;?></textarea> <input type="button" value="Reset" onclick="window.reset();" name="reset"> </td> </tr> <? } } } i've trying to create a button or image to reset one textarea (from whole array) and so far i've been unsuccessful. i've seen this on other website and i know it is possible to do this, pls help! I have some code to pick a wire size and conduit size from 2 separate drop down list. Then inside the js it is evaluated to decide how many wires. My problem is I can't figure out how to make the drop down options go into the JS. I just put in an error alert to test if they were for now. Here is my code: Code: function fillcap(){ var wire = document.getElementById("wireSize"); var conduit = document.getElementById("conduitSize"); if (wire.option.length >= 10 && conduit.option.length == .5) { windows.alert("Wire Size exceeds conduit max fill!") } And the html Code: <h2>Fill Capacity</h2><br> <b>Wire Size</b><br> <select id ="wireSize"> <option value="1">#14</option> <option value="2">#12</option> <option value="3">#10</option> <option value="4">#8</option> <option value="5">#6</option> <option value="6">#4</option> <option value="7">#3</option> <option value="8">#2</option> <option value="9">#1</option> <option value="10">1/0</option> <option value="20">2/0</option> <option value="30">3/0</option> <option value="40">4/0</option> <option value="250">250</option> <option value="300">300</option> <option value="350">350</option> <option value="400">400</option> <option value="500">500</option> <option value="600">600</option> <option value="700">700</option> <option value="750">750</option> </select> <br> <b>Conduit Size</b><br> <select id="conduitSize"> <option value=".5">1/2</option> <option value=".75">3/4</option> <option value="1">1</option> <option value="1.25">1-1/4</option> <option value="1.5">1-1/2</option> <option value="2">2</option> <option value="2.5">2-1/2</option> <option value="3">3</option> <option value="3.5">3-1/2</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select><br> <input value="Wires allowed" onclick="fillcap()" type="button"> <input type="text" name="myresultbox" id="resultbox10"> Wires<br> Thank you for any advice. Hi, Firstly, I would like to introduce myself. I am new to the application framework in sencha and JS. Acutally i have to pop an image on click of the text. I checked some of the same codes and wrote this code in sencha javascript. can any one please check what's wrong with this code and let me know how to call this function from html code. function showEditWindow() { var win = new Ext.Window({ title: 'image', width: 100, height: 100, html: '<img src=\"p1.png\"></img>', }); win.show(); return win; }; Hello experts ;p I'm new and i found this forums within google. I been stuck in a whole pile of thoughts and whatnot. I run a website for music community and basically postings of artists and their info.. Now a lot of my posters and specially the new ones don't know HTML at all so i'm the only one with HTML experience. So basically think in a way Wordpress. Authors need to post info about a band or artist .. Now it's a long progress to do by hand the same format and whatnot so what i need is i have already a layout i made in dreamweaver but the info is all marked as "Default Info" To put this short, i need so that my authors just fill out a Form that has all the required fields like "Bands Name" "Bands Bio" and they fill in the boxes. Now i those values to go in a Textarea so they just copy all the HTML and just paste it in the submission page so they all have the same format... Now i know how to make a form but using values from a form to go in a predefined html page so like.. would go on a page like this. Code: <html> <body> <h1>Value Band Name Here</h1> <br> <br> <h2>Band Biography</h2> <br> <VALUE Band BIO Here> <br> Albums :<br> <VALUE ALBUM NAME, VALUE ALBUM YEAR,<br> <br> <img src="ALBUM ART LOCATION VALUE HERE"> And so on.. Do you guys catch my drift? So they fill a form that then they click GENERATE CODE and the above goes in a textarea they copy from but the values are already filled from the form so it doesn't show up as <VALUE BAND NAME> it would just show what you filled in.. Any help would solve this problem that i been having for the past 3 months. Thank you if any help! PSSS I had this from someone but when i modified it , i broke it.. Is there a simpler way? PHP Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>band form</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> * { margin:0; padding:0; } body { background-color:white; } label, textarea { display:block; } </style> <script type="text/javascript"> window.onload=function() { document.getElementById('band').onsubmit=function() { var bandname=document.getElementById('bandname').value; var bio=document.getElementById('bio').value; var album1=document.getElementById('album1').value; var album1y=document.getElementById('album1y').value; var album1i=document.getElementById('album1i').value; var album2=document.getElementById('album2').value; var album2y=document.getElementById('album2y').value; var album2i=document.getElementById('album2i').value; var album3=document.getElementById('album3').value; var album3y=document.getElementById('album3y').value; var album3i=document.getElementById('album3i').value; var text="<h1>"+bandname+"</h1>\n\r<h2>Band Biography</h2>\n\r<p>"+bio+"</p>\n\r<h3>Albums</h3>\n\r<ul>\n\r<li>"+album1+" : "+album1y+" <img alt=\""+album1+"\" src=\""+album1i+"\"></li>\n\r<li>"+album2+" : "+album2y+" <img alt=\""+album2+"\" src=\""+album2i+"\"></li>\n\r<li>"+album3+" : "+album3y+" <img alt=\""+album3+"\" src=\""+album3i+"\"></li>\n\r</ul>"; document.getElementById('code').value=text; return false; } } </script> </head> <body> <form id="band" action="#"> <label>Band name: <input type="text" id="bandname"></label> <label for="bio">Band bio: </label> <textarea rows="20" cols="80" id="bio"></textarea> <label>Album 1: <input type="text" id="album1"></label> <label>Album 1 year: <input type="text" id="album1y"></label> <label>Album 1 image location: <input type="text" id="album1i"></label> <label>Album 2: <input type="text" id="album2"></label> <label>Album 2 year: <input type="text" id="album2y"></label> <label>Album 2 image location: <input type="text" id="album2i"></label> <label>Album 3: <input type="text" id="album3"></label> <label>Album 3 year: <input type="text" id="album3y"></label> <label>Album 3 image location: <input type="text" id="album3i"></label> <input type="submit"> </form> <p>Copy this:</p> <textarea rows="20" cols="80" id="code"></textarea> </body> </html> i want to build a form have a "payment" select option ex. when user choose option "credit card" is will show some textbox(firstname and lastname,ccnumber,ccv,expday...) when user choose option "paypal" is will show some textbox(firsname,email paypal). Please help me solve this Hey guys, I've never use JavaScript before so bare with me. But, I have a registration form, and I want to have a location field in it, and then a region field that changes depending on what the user set as their location. But, I cannot get it to work, and I have no idea of how to go about doing it. Here is the JavaScript I have been using so far: Code: function toggleTable(select) { if(select.value == "uk") { select.value = "uk"; document.getElementById("region2").style.visibility = "collapse"; document.getElementById("region1").style.visibility = "visible"; } else if(select.value == "usa") { select.value = "usa"; document.getElementById("region1").style.visibility = "collapse"; document.getElementById("region2").style.visibility = "visible"; } } and it does show the right region depending on what the user inputed, but when the page loads, all the fields show up until the user click on the location field, here is the code for that so you can test it out: Code: <tr><td>Location: </td><td><select name="location" onclick="toggleTable(this);"> <option value="none">Please Select One</option> <option value="uk">UK</option> <option value="usa">USA</option> </select></td></tr> <tr id="region1"><td>Region: </td><td> <select name="region"> <option value="uk1">uk1</option> <option value="uk2">uk2</option> </select></td></tr> <tr id="region2"><td>Region: </td><td> <select name="region"> <option value="usa1">usa1</option> <option value="usa2">usa2</option> </select> </td></tr> Any help at all please? Wondering if anyone could point me in the right direction! I am trying to create a HTML form for a hire company that has multiple selection criterias i.e. mpg, passenger/seats, gearbox etc etc - based on these selections I need the form information to check against my JS object/array and find those objects which match the relevant attributes. The form itself has only radio buttons and one text field - I know how to take the data from an element of the form and put it into a variable so I can check it, but what I really want is to have all the information on the form matched against my object - Would I be looking at perhaps putting the form selections into a blank/new array and then comparing that to the object? If so any help/guidance would be greatly appreciated! Code: //array information */ var car=new Array("Lamborghini Aventador", "Peugeot 107", "VW Golf", "Toyota Prius", "Kia Sedona", "Citroen 2CV", "Vauxhall Insignia", "Mercedes C180", "Reliant Robin", "Ford Fiesta"); var mpg=new Array(13, 61, 47, 65, 32, 62, 40, 30, 70, 49); var passenger=new Array(2, 4, 5, 5, 7, 4, 5, 5, 2, 5); var luggage=new Array(0, 1, 2, 2, 4, 1, 3, 2, 1, 2); var fuel=new Array("Petrol", "Petrol", "Diesel", "Petrol", "Diesel", "Petrol", "Diesel", "Petrol", "Petrol", "Petrol"); var gearbox=new Array("Semi-Automatic", "Manual", "Manual", "Manual", "Manual", "Manual", "Automatic", "Automatic", "Manual", "Automatic"); var aircon=new Array("Yes", "No", "Yes", "Yes", "Yes", "No", "Yes", "Yes", "No", "Yes"); var daycost=new Array(2000, 30, 34, 44, 40, 25, 45, 87, 10, 31); var weekendcost=new Array(3800, 90, 97, 110, 99, 70, 115, 243, 25, 90); var weeklycost=new Array(12000, 135, 167, 183, 162, 124, 173, 560, 65, 130); var cars = {}; for(var i=0;i<car.length;i++) { cars[i] = { name: car[i], mpg: mpg[i], passenger: passenger[i], luggage: luggage[i], fuel: fuel[i], gearbox: gearbox[i], aircon: aircon[i], daycost: daycost[i], weekendcost: weekendcost[i], weeklycost: weeklycost[i] } } 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=UTF-8"> <title>Car Hires</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="array.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Car Hires</a></h1> <form id="myform" class="appnitro" method="post" action=""> <div class="form_description"> <h2>Car Hires</h2> <p>Fill the form below, and we will provide you with a list of cars that match your requirements.</p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Name </label> <span> <input id="element_1_1" name= "fname" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="element_2">Email </label> <div> <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li class="section_break"> <h3>Section Break</h3> <p></p> </li> <li id="li_4" > <label class="description" for="element_4">No. of Passengers </label> <div> <input id="element_4" name="passengers" class="element text small" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_4"><small>Enter the number of passengers in numerical format</small></p> </li> <li id="li_5" > <label class="description" for="element_5">Items of Luggage </label> <span> <input id="element_5_1" name="luggage" class="element radio" type="radio" value="1" /> <label class="choice" for="element_5_1">1</label> <input id="element_5_2" name="luggage" class="element radio" type="radio" value="2" /> <label class="choice" for="element_5_2">2</label> <input id="element_5_3" name="luggage" class="element radio" type="radio" value="3" /> <label class="choice" for="element_5_3">3</label> <input id="element_5_4" name="luggage" class="element radio" type="radio" value="4" /> <label class="choice" for="element_5_4">4</label> </span> </li> <li id="li_6" > <label class="description" for="element_6">Fuel Type </label> <span> <input id="element_6_1" name="fuel" class="element radio" type="radio" value="1" /> <label class="choice" for="element_6_1">Diesel</label> <input id="element_6_2" name="fuel" class="element radio" type="radio" value="2" /> <label class="choice" for="element_6_2">Petrol</label> </span> </li> <li id="li_7" > <label class="description" for="element_7">Transmission/Gear Box </label> <span> <input id="element_7_1" name="gearbox" class="element radio" type="radio" value="1" /> <label class="choice" for="element_7_1">Automatic</label> <input id="element_7_2" name="gearbox" class="element radio" type="radio" value="2" /> <label class="choice" for="element_7_2">Manual</label> </span> </li> <li id="li_8" > <label class="description" for="element_8">Airconditioning </label> <span> <input id="element_8_1" name="aircon" class="element radio" type="radio" value="1" /> <label class="choice" for="element_8_1">Yes</label> <input id="element_8_2" name="aircon" class="element radio" type="radio" value="2" /> <label class="choice" for="element_8_2">No</label> </span> </li> <li id="li_9" > <label class="description" for="element_5">Miles Per Gallon</label> <span> <input id="element_5_1" name="MPG" class="element radio" type="radio" value="1" /> <label class="choice" for="element_5_1">10-30</label> <input id="element_5_2" name="MPG" class="element radio" type="radio" value="2" /> <label class="choice" for="element_5_2">30-50</label> <input id="element_5_3" name="MPG" class="element radio" type="radio" value="3" /> <label class="choice" for="element_5_3">50-80</label> </span> </li> <li id="li_10" > <label class="description" for="element_9">Duration of Rental </label> <div> <select class="element select medium" id="element_9" name="element_9"> <option value="" selected="selected"></option> <option value="1" >Day</option> <option value="2" >Weekend</option> <option value="3" >Full Week</option> </select> </div> </li> <li class="buttons"> <input type="hidden" name="form_id" value="365314" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> <div id="footer"> Car Hire Form</a> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> </html> I have created a simple webpage that allows users to search multiple comparison shopping sites at once. This is just a side project that I am working on. At the current time, the webpage has the sites listed with checkboxes. The user can put in a search term in the box and then select which sites they want to search. The sites then open in a new window or on different tabs depending on which browser they are using. What I would like to do is find out if there is a way to have the same thing, but the sites open in the same window below the search box, like in tabbed frames. I tried doing something with the tabbed viewer script from dynamic drive: http://www.dynamicdrive.com/dynamici...bdocviewer.htm, but was unable to figure out how to get the search parameter into the url. My page can be found at http://www.imarkinteractive.com/tools/onesearch.html and all of the javascript is on the page. Does anyone know if this can be accomplished and if so, how would I go about doing it. I can run a php script on my server if that would be easier, but I would really appreciate the assistance. Thanks. |