JavaScript - I Need Help To Make Form With Only 1 Filed
In my website i have many articles... URL of each article is like below
http://www.mysite.com/article/1 http://www.mysite.com/article/2 http://www.mysite.com/article/3 http://www.mysite.com/article/4 Etc... So each article got a number in the URL >>>>> What I need now is <<<<<< To make little form with only 1 filed in main page Filed is to add the article number... Then by submitting the form the URL of article will open For example: If I enter number 4 and click submit That will open URL http://www.mysite.com/article/4 Thank you Similar TutorialsHello, I have this code: PHP Code: <script> function checkForOther(obj) { if (!document.layers) { var txt = document.getElementById("otherTitle"); if (obj.value == "new") { txt.style.display = "inline"; // gives the text field the name of the drop-down, for easy processing txt.name = "selTitle"; obj.name = ""; } else { txt.style.display = "none"; txt.name = ""; obj.name = "selTitle"; } } } </script> it's should hide/show input field accourding the user choice - if he choose "<option value='new'>new</option>", the follow action should happend: PHP Code: <li id='otherTitle'> <label for='new'>new artist</label> <input type='text' name='new_artist_name' /> </li> The script works, but when I click "submit" the parameter that the "select box" should send don't get send... here is the full code: PHP Code: <li> <label for='artist'>Artists</label> <select name='artist_id' onchange="checkForOther(this)\"> <option value='new'>new artist</option>"; $query = mysql_query("SELECT id, name FROM `chords_artists` ORDER BY `name` "); while($index = mysql_fetch_array($query)) { $artist_id = $index['id']; $artist = $index['name']; echo "<option value='$artist_id'>$artist</option>"; } echo " </select> </li> <li id='otherTitle'> <label for='new'>new artist:</label> <input type='text' name='new_artist_name' /> </li> Can you please help me with it? Hello, I am hoping someone can help me with following search form. As you can see I have created a form but I don't know how to fix the coding so when a user select a category it will add a different hidden filed for that option for example: When the user selects category "Men" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://men.com/acatalog/"> will be added and when the user selects category "Kids" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://kids.com/acatalog/"> will be added and so on... Here is my form coding I am using: Code: <form name="simplesearch" method="get" action="" onsubmit="ssite=document.getElementById('sitelist');this.action=ssite.options[ssite.selectedIndex].value;return true;"> <input type="hidden" name="page" value="search" /> <input type="hidden" name="PR" value="-1" /> <input type="hidden" name="TB" value="A" /> <input type="hidden" name="NOLOGIN" value="1" /><input align="top" class="main_search_box" name="SS" type="text" value="search for ..." onfocus="this.value='';"> Search within: <select id="sitelist"> <option value="">Select Catagory</option> <option value="http://kids.com/cgi-bin/ss000001.pl">kids</option> <option value="http://men.com/cgi-bin/ss000001.pl">men</option> <option value="http://women.com/cgi-bin/ss000001.pl">women</option> </select><input type="submit" class="button" name="ACTION" value="Go!"> </form> Also I have one more question how do I make the "Select Catagory" a Must Choose and if not chosen to give message that say"Please Select a Category" Thank you in advance for any help you can give me... I am a bigginer so please go easy on me Greetings! I am currently working on my own company's website I am currently working with the FAQ page and I need to make a simple textbox, where visitors can type and ask a question and submit it, the question the visitor typed needs to be read by javascript from a seperate xml file which should be read with javascript. Now i dont know how to start with this and I would appreciate if someone could give me a lead on what things i should do and etc. Best regards Obs Hi all, I've been trying to build a form with dynamic checkboxes. I'd like to have a master 'select none' checkbox in a few form fields which has 2 key functions:- 1) clearing all field boxes the user may have entered before opting to select none 2) disabling all field options to make it impossible for the user to tick both 'none' and other options. This 'select none' checkbox should be ticked by default, so when the user unchecks it, the rest of the field options light up. I'm a complete novice but I have it working ok having stitched a few pieces of code I've found together, however I don't think it's very efficient. I have had to duplicate both bits of the javascript to make it work, changing only the function names in the <head> area ('Uncheck' and 'Uncheck2') and the class variables in the form in the <body> area ('fruit_child' and 'veg_child'). As this form will have several more fields eventually, I'm looking for a better way to do this while maintaining the functionality. Ive read bits about object-orientated programming which may be what I'm looking for to make this more efficient, but I'm not sure how to implement it in this example. Can a more experienced coder please help? Kind thanks, Fleef Code: <head> <SCRIPT LANGUAGE="JavaScript"> // Check_ctr: clears all when 'none' box ticked --> function Uncheck(chk) { if(document.myform.Check_ctr.checked==true){ for (i = 0; i < chk.length; i++) chk[i].checked = false ; } } // End --> </script> <SCRIPT LANGUAGE="JavaScript"> // Check_ctr: clears all when 'none' box ticked --> function Uncheck2(chk_veg) { if(document.myform.Check_ctr_veg.checked==true){ for (i = 0; i < chk_veg.length; i++) chk_veg[i].checked = false ; } } // End --> </script> </head> <body> <form name="myform" method="post"> <input type="checkbox" id="none_fruit" name="Check_ctr" value="yes" onClick="Uncheck(document.myform.fruit)" checked><b>None</b><br> <input type="checkbox" name="fruit" value="1" class="fruit_child" disabled="true">1<br> <input type="checkbox" name="fruit" value="2" class="fruit_child" disabled="true">2<br> <input type="checkbox" name="fruit" value="3" class="fruit_child" disabled="true">3<br> <input type="checkbox" name="fruit" value="4" class="fruit_child" disabled="true">4<br> <input type="checkbox" name="fruit" value="5" class="fruit_child" disabled="true">5<br> <script> // disables options when 'none' ticked --> $(function(){ $("#none_fruit").click ( function() { if ( !$(this).is ( ":checked" ) ) { $(".fruit_child").removeAttr ( "disabled" ); } else { $(".fruit_child").attr ( "disabled" , true ); } }); });</script> <br><br><br> <input type="checkbox" id="none_veg" name="Check_ctr_veg" value="yes" onClick="Uncheck2(document.myform.veg)" checked><b>None</b><br> <input type="checkbox" name="veg" value="1" class="veg_child" disabled="true">1<br> <input type="checkbox" name="veg" value="2" class="veg_child" disabled="true">2<br> <input type="checkbox" name="veg" value="3" class="veg_child" disabled="true">3<br> <input type="checkbox" name="veg" value="4" class="veg_child" disabled="true">4<br> <input type="checkbox" name="veg" value="5" class="veg_child" disabled="true">5<br> <script> // disables options when 'none' ticked --> $(function(){ $("#none_veg").click ( function() { if ( !$(this).is ( ":checked" ) ) { $(".veg_child").removeAttr ( "disabled" ); } else { $(".veg_child").attr ( "disabled" , true ); } }); });</script> </form> I have a form with a postcode field in it I want to add a button or text link next to this field which if clicked on goes to the google maps url querying that postcode i.e. if the postcode text in the field (form not submitted) was SW1A 1AA then without submitting that form there would be a button / link next to it which when clicked on went to "http://maps.google.co.uk/?q=SW1A1AA" Pretty sure Java should be able to do this ? here is the html code that i have PHP Code: <td valign="middle" valign="middle"> <input type="radio" name="gender" id="genderM" value="Male" /> Male <input type="radio" name="gender" id="genderFM" value="Female" /> Female </td> and here is the js funtion PHP Code: var $j = jQuery.noConflict(); function isValidEmail(str) { return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); } function validateForm(){ var firstName; var lastName; var email; var mobile; var comment; var error; firstName = $j('#firstName').val(); lastName = $j('#lastName').val(); email = $j('#email').val(); mobile = $j('#mobile').val(); comment = $j('#comment').val(); if(firstName=='' || firstName.length < 3){ error = 'Please Enter Your First Name'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(lastName=='' || lastName.length < 3){ error = 'Please Enter Your Second Name'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } //mob //$jmob_pattern = '^\d{10}$j'; if(mobile.length != 10 || isNaN(mobile)){ error = 'Please Enter Your Mobile Number'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(email=='' || !isValidEmail(email)){ error = 'Please Enter Your Email Address'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(comment.length < 5){ error = 'Please Enter A Comment'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } return true; } Does anybody know how i check to see if the radio button is select and also can anybody tell me how i can check for an email in the correct format the function isValidEmail in the above alows emails to pass through if they are in this format aaa@aaa. i only want them to go through if they are aaa@aaa.com Thanks for your help if you give it I found this copy and paste java script for slide shows... I can only put 1 on the page then the other don't work... how do i edit it so i can put multiple on 1 page? http://www.javascriptkit.com/script/.../jsslide.shtml Code: <script language="JavaScript1.1"> <!-- /* JavaScript Image slideshow: By JavaScript Kit (www.javascriptkit.com) Over 200+ free JavaScript here! */ var slideimages=new Array() var slidelinks=new Array() function slideshowimages(){ for (i=0;i<slideshowimages.arguments.length;i++){ slideimages[i]=new Image() slideimages[i].src=slideshowimages.arguments[i] } } function slideshowlinks(){ for (i=0;i<slideshowlinks.arguments.length;i++) slidelinks[i]=slideshowlinks.arguments[i] } function gotoshow(){ if (!window.winslide||winslide.closed) winslide=window.open(slidelinks[whichlink]) else winslide.location=slidelinks[whichlink] winslide.focus() } //--> </script> Code: <a href="javascript:gotoshow()"><img src="food1.jpg" name="slide" border=0 width=300 height=375></a> <script> <!-- //configure the paths of the images, plus corresponding target links slideshowimages("food1.jpg","food2.jpg","food3.jpg","food4.jpg","food5.jpg") slideshowlinks("http://food.epicurious.com/run/recipe/view?id=13285","http://food.epicurious.com/run/recipe/view?id=10092","http://food.epicurious.com/run/recipe/view?id=100975","http://food.epicurious.com/run/recipe/view?id=2876","http://food.epicurious.com/run/recipe/view?id=20010") //configure the speed of the slideshow, in miliseconds var slideshowspeed=2000 var whichlink=0 var whichimage=0 function slideit(){ if (!document.images) return document.images.slide.src=slideimages[whichimage].src whichlink=whichimage if (whichimage<slideimages.length-1) whichimage++ else whichimage=0 setTimeout("slideit()",slideshowspeed) } slideit() //--> </script> <p align="center"><font face="arial" size="-2">This free script provided by</font><br> <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript Kit</a></font></p> I want the dynamically add fields can be appear with a contain of php code, but I have not found the way, I wondering there who are willing to help me. my code as fallowing: Code: <!-- // another fields here //--> <div id="new_field"--></div> <script type="text/javascript"> var inputs = { fields: 0, target: "new_field", addInput: function() { if (this.fields != 5) { this.fields++; var newElement = document.createElement('div'); newElement.id = this.target + this.fields; newElement.innerHTML = "<?php if ($emails) { foreach ($emails as $result) { ?><b><?php echo $entry_emails; ?></b><br /><input type='text' name='emails[]' value='<?php echo $result; ?>' size='auto' maxlength='100%' /><?php } } ?>"; document.getElementById(this.target).appendChild(newElement); } else { alert("Only 5 fields allowed."); } }, };</script> i know it does not appear because the php code Quote: newElement.innerHTML = "<?php if ($emails) { foreach ($emails as $result) { ?><b><?php echo $entry_emails; ?></b><br /><input type='text' name='emails[]' value='<?php echo $result; ?' size='auto' maxlength='100%' /><?php } } ?>"; but please let me know is there another idea and pointer to make it work?, I would appreciate it and many thanks. HI evey one I want to make a vote music web site , some thing like this : http://www.pmctop20.com/ we can drag each of the items in the left panel and drag it to the vote rows . How can I do so? It's a jquery script Thanks like, for user and password on a site I'm still pretty new to this Is there Java Script to show only the Comment and Markup tool bar in a pdf document? I have the toolbars hidden on initial view, but I need to be able to make it so that one toolbar appears. I have figured out how to make all toolbars re-appear, but I don't want users to be able to do that (at least not easily).
Hello, I Installed a Javascript on my site but the font is very small The code Code: <script type="text/javascript"> TargetDate = "03/12/2010 12:00 PM"; BackColor = ForeColor = CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%D%% يوم, %%H%% ساعة, %%M%% دقيقة, %%S%% ثانية"; FinishMessage = "It is finally here!"; </script> <script type="text/javascript" src="http://f1zcdn.appspot.com/js/countdown.js"></script> How can i make the font in "yellow" bigger ? Thank you Hey guys, im in need of some more java script help (by the way thanks for all the other times you guys have helped me) need to create a search box that whatever is in the search box will come up at the end of the URL https://****/DirectConnect/Getpremie...Chassis|X##### the last 6 charecters should be replaced with what ever number that in the search box so X##### should be replaced by 123456 for example or any other number Hi everyone, Someone made a website for my uncle, now he is telling me to fix a problem with it. The problem is that he made a type of image posting system/script on the right bottom of the page{You can see it in the attached image} and its not working at all. The address of website is http://www.signsgifts.com/ [IMG][img=http://s7.postimage.org/69zoetnsn/Screenshot_at_2012_05_03_15_28_28.jpg][/IMG] I am new to developing.. Thanks Hi All members i need helping in creating content slider look like this; http://wpclassipress.com/demo/ note; I ask for creating slider look like this (Thumbnail imge and Title under it) plz any tips to do that, My new WP site depends on this part...plz help Hello, Any suggestions for how to make this sort of gallery - http://www.timsimmons.co.uk/index.php ? I am making a website for a friends degree show and really like the minimal aesthetic. I'm not a fan of the usual JS plugin galleries. One thing I can't work out how they have done is link the text caption above to the images. This has been niggling at me for days! I am new to JS so please go easy on me. Cheers, Andy Hi guys, first of all im sorry cause i dont know the javascript name and what should this call. i wanted to make a Helps and Guides look like this website http://fnatic.com/ Feedback that located on the left side. If can totally make like them then i hope the script can open a new window with custom size and address bar. I hope someone can help me... i will change my topic tittle if i know what is this call. sorry im a pure newbie in web programming. hopes you all can help me. thanks alot. I have a Java script chat, How would I make a scroll bar for it? Does any one have any code for that? or do you know what I have to do? thanks, Yo_papa75 I need the rolling and the displaying in a loop and i am clueless. If anyone could help it would be much appreciated. <html> <head> <title> Die Rolls </title> <script type="text/javascript" src="http://balance3e.com/random.js"> </script> <script type="text/javascript"> function RollDice() { var roll1, roll2, roll3, roll4, roll5; roll1 = RandomInt(1, 6); roll2 = RandomInt(1, 6); roll3 = RandomInt(1, 6); roll4 = RandomInt(1, 6); roll5 = RandomInt(1, 6); document.getElementById('die1Img').src = 'http://balance3e.com/Images/die' + roll1 + '.gif'; document.getElementById('die2Img').src = 'http://balance3e.com/Images/die' + roll2 + '.gif'; document.getElementById('die3Img').src = 'http://balance3e.com/Images/die' + roll3 + '.gif'; document.getElementById('die4Img').src = 'http://balance3e.com/Images/die' + roll4 + '.gif'; document.getElementById('die5Img').src = 'http://balance3e.com/Images/die' + roll5 + '.gif'; document.getElementById('rollSpan').innerHTML = parseFloat(document.getElementById('rollSpan').innerHTML) + 1; } </script> </head> <body bgColor="lime"> <div style="text-align:center"> <p> <img id="die1Img" alt="die image" src="http://balance3e.com/Images/die1.gif"> <img id="die2Img" alt="die image" src="http://balance3e.com/Images/die2.gif"> <img id="die3Img" alt="die image" src="http://balance3e.com/Images/die3.gif"> <img id="die4Img" alt="die image" src="http://balance3e.com/Images/die4.gif"> <img id="die5Img" alt="die image" src="http://balance3e.com/Images/die5.gif"> </p> <input type="button" value="Click to Roll" onclick="RollDice();"> <hr> <p> Number of rolls: <span id="rollSpan">0</span> </p> </div> </body> </html> I am terrible at this. I want to get this functionality seen here http://davidlynch.org/js/maphilight/docs/demo_usa.html (image map areas highlighting on mouseover) to work on this here http://scratchitrich.com/test/ can anybody walk me through how to make this work? Thanks! |