JavaScript - Setting Postcode To Load Automatically?
Hi,
I would like to set the postcode Code: <?php echo $pubdetails['rsPostCode]; ?> as a default value in the form field so that the map area loads up automatically for instance the link above uses postcode bn11 3rg thanks Similar TutorialsI am very new to Javascript and I have been able to get the menu to close and open, but I can't figure out how to start it up automatically closed at first. I've tried setting ids and values, but nothing seems to work! Please help me out! Code: <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Lab 5_3</title> <script type="text/javascript"> function collapseItem(whichitem) { if (document.getElementById(whichitem).style.display == "none") { document.getElementById(whichitem).style.display = "block"; } else { document.getElementById(whichitem).style.display = "none"; } } </script> </head> <body> <p><a href="#" onClick="collapseItem('category1')">Menu 1</a></p> <div id="category1"> <ul> <li>Option 1</li> <li>Option 2</li> </ul> </div> </body> </html> Hey there. I'm creating my web-site now. I'm planing to have some slide/object change by itself. I know Java Script perform this task. I have get the code and apply to the image I want. It works. My idea is each of my image upper left corner have the representative number of the slide. When the slide1 go to slide 2 automatically, the number will change colour from 1 to 2. When the user click the number, the slide will change according to the number. Let said I have 3 slide. Each slide and have no 1 ,2 ,3 move forward, move backward icon on the upper left corner. I have slide1 ,slide2, slide3 change by itself within 2.5 second. When the user go thru slide 1, slide 2 and till slide3, user find out he/she interested on slide 1 and by clicking 1 on the upper left corner, the slide will change back to slide 1. Something like showing on the home page at www.easyjet.com.EN or http://www.thomascook.com/ . Both home page show a slide. This is what exactly I want. I learn HTML code before but not Java Script. I have borrow many Java Script reference book. but no idea how to inside the number on the upper left corner on each slide and how the number work accordingly with the slide. So sorry if you can't understand what I was talking about. But, anyone who understand me or have any idea how can I mortify the Java script to what I want. Just answer or email me to trista_soo@yahoo.com or facebook me on sym107@hotmail.com. Thanks for your time and efforts. Your help I really appreciate. Cheers! Hi, I am hoping I just need to be pointed in the right direction with this. I have Page1. When Page1 body onloads it uses Ajax to call PartA Within PartA I have a message board so members can write messages which will be sent to my database in PartA[1] and immediately posted for view on to PartA[2]. As I want to have my request to the server updating regularly I want to have PartA[2] on a timed loop to refresh - I do not need the content of PartA[1] to refresh. So the order of events would look like this: Page1 | onload call | v PartA / \ V V PartA[1] PartA[2] (loads once) (constantly refreshes) What I am not sure about is that I have <body> and <head> attributes in Page1 only. I have already used my body onload to call PartA (and can't use it to call PartA[2] before PartA has loaded anyway). I do not want the user to have to click a button or do anything to call up PartA[2]. So my question is how would I get PartA[2] to automatically load within PartA? I hope I have made this clear, but if I haven't let me know and I will try again. I was wondering if there was a simple way of notifying a user who has entered an incorrect postcode? I have found numerous answers to this problem but i am sure there is a simpler way to do it as ones i have found have rows and rows of code. Help is much appreciated Hi all, I have a script that validates a postcode, including checking that the 4th character from the end of the postcode is a space. To save sending you back to the postcode textbox to correct the error, how can I automatically force a space at the 4th character position from the end of the postcode? ie, CM12JB is wrong. Need to change it to CM1 2JB. Any ideas? Gary Hi, basically it's a simple postcode validator. It checks to see whether the postcode is in UK format, then tells you if it isn't with an alert box, then I want it to clear the field. The input field's ID is postcode. Code: function testPostCode () { var myPostCode = document.getElementById('postcode').value; if (checkPostCode (myPostCode)) { document.getElementById('postcode').value = checkPostCode (myPostCode) } else {alert ("Please enter your Postcode correctly, this includes:\n \n * Correct Spacing - AA1 1AA \n * Correct amount of letters and numbers. \n \n Sorry if this causes any inconvenience, but it is to your benefit.")}; document.postcode.value=""; } Anyone able to help me? http://auspost.com.au/apps/postcode.html Basically I want to build the same thing. The data is freely available there as a download. I couldn't find anything existing in the jquery plugin space. Can anyone offer pointers on how to achieve it? Hi all Is there a way to get the image(s) to load into the table after the page has loaded instead of the way I have it now? I have 4 tabs, but I would like the imgs in tabs 2,3,4 to load after page load. Example of how the tabs look. Code: <div class="tabbertab"> <h2>Australia_____</h2> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFCC"> <caption class="highlight_Red">澳洲 Australia </caption> <tr> <td><a href="pages/promotion.html#aus_ACE" rel="nofollow" target="_blank"><img src="pages/images/Pics/AUS/ace.jpg" alt="ACE / ATTC" width="110" height="69" border="0" align="left" class="ozimg_L"/> ...a few more images etc the other tabs look the same. LT This script displays a link to a registration/login form that loads in a light box for Joomla. I've been goin nuts trying to figure out how to get this to load on page load with a delay. Anyone know how to get this done? PHP Code: <?php JHTML::_('behavior.mootools'); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'media/system/css/modal.css'); $document->addScript(JURI::base() . 'media/system/js/modal.js'); $document->addScriptDeclaration("window.addEvent('domready', function() {SqueezeBox.initialize({});});"); $user = & JFactory::getUser(); $uri = JFactory::getURI(); $url = $uri->toString(); $return = base64_encode($url); ?> <div id="lbframeid" style="position:absolute;top:1px;left:1px;height:0px;width:0px;overflow:hidden"> <a href="http://www.wowjoomla.com/"><h1>Joomla Login LightBox powered by WowJoomla.com</h1> </a> </div> <?php if ($user->get('guest')) :?> <a href="<?php echo JRoute::_('index.php?option=com_loginbox')?>" onclick="SqueezeBox.fromElement(this); return false;" rel="{handler: 'iframe', size: {x: 660, y: 500}}"><?php echo JText::_('SIGNUP_LOGIN')?></a> <?php else: ?> <?php echo JText::sprintf( 'HINAME', $user->get('name') ); ?> <br> <a href="javascript:void(0);" onclick="LB_onLogout(); return false;"><?php echo JText::_('LOGOUT')?></a> <?php endif; ?> <script type="text/javascript"> function LB_onLogout() { var form = new Element('form'); form.setProperty('method', 'POST'); form.setProperty('target', '_self'); form.setProperty('action', 'index.php'); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'option'); input.setProperty('value', 'com_user'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'task'); input.setProperty('value', 'logout'); form.appendChild(input); var input = new Element('input'); input.setProperty('type', 'hidden'); input.setProperty('name', 'return'); input.setProperty('value', '<?php echo $return; ?>'); form.appendChild(input); $E('body').appendChild(form); form.submit(); } </script> Hi guys, I am trying to insert the following call into my page; Code: <script type="text/javascript" defer="true"> $('#query').autocomplete({ serviceUrl:'service/autocomplete.ashx', minChars:1, delimiter: /(,|;)\s*/, // regex or character maxHeight:400, width:250, deferRequestBy: 0, //miliseconds params: { country:'Yes' }, //aditional parameters // local autosugest options: lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values }); </script> It works fine in all browsers except ie(6,7,8) Code: Internet Explorer can not open website. Operation Aborted. I understand it is caused by the jquery autocomplete function loading before the page / DOM has fully loaded. I tried adding Defer="true" to the script however this doesn't seem to work. Could someone please tell me what i must add to the script so that it loads after the dom has fully loaded? Thanks guys George hello .. i have some problem while while working on a script.. i want to use confirmation() function to confirm submit button and if its true ...then submit form... else keep on same page (thats logic) am using php as server scripting .. and i wrote ..in php PHP Code: <form action="del_cat.php\" name=\"myform\" method=\"post\"> "; Delete: <input type="submit\" name=\"delete\" onclick=\"confirmation()\" value=\"Delete\" > <br> Edit:<input type=\"submit\" name=\"edit\" value=\"Edit\" > </form>"; and used a javascript in head PHP Code: <script type="text/javascript\"> function confirmation() { var r=confirm(\"Are you ready to delete?\"); if (r==true) { document.myform.submit(); } else { alert(\"check twise before submitting \") } } </script> my problem is if i click "OK" or "Cancel" both case the form is automatically submitting ... see i used PHP Code: if (isset($_POST['delete'])) { mysql_query("DELETE FROM ********* WHERE id='{$_POST['cid']}'"); } this code to invoke the function .. I have 3 divs (boxes) next to each other, I can input text via a textarea to each. I need all 3 to resize - be the same size on text overflow - so if box a gets 100 lines of code and resizes, the other 2 should follow. I have written this js, and added it to the button which moves the text to the boxes (to the onclick) Code: // JavaScript Document function adjust() { if (document.getElementById('section1').style.height != 380 + "px") { document.getElementById('section2').style.height === document.getElementById('section1').style.height; document.getElementById('section3').style.height === document.getElementById('section1').style.height; } else if (document.getElementById('section2').style.height != 380 + "px") { document.getElementById('section1').style.height === document.getElementById('section2').style.height; document.getElementById('section3').style.height === document.getElementById('section2').style.height; } else if (document.getElementById('section3').style.height != 380 + "px") { document.getElementById('section1').style.height === document.getElementById('section3').style.height; document.getElementById('section2').style.height === document.getElementById('section3').style.height; } } any ideas what's wrong here? I'm no javascript expert, in fact i know very little. I Design wordpress themes in photoshop and I'm looking to add a little more "spice" to my themes using jQuery UI so i made a theme with this tabbed horizontal navigation with the sub menu showing horizontally under the menu when you hover over it. So i searched google on how to do this jQuery menu and got this. Code: <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#main_nav li a.main").hover(function(){ $("#main_nav li a.main").removeClass("active"); $(this).addClass("active"); $(this).queue(function() { $(".sub_nav").fadeOut(); $(this).siblings(".sub_nav").fadeIn(); $(this).dequeue(); }); }); }); </script> The other part Code: <div class="menu"> <ul id="main_nav"> <li><a href="" class="main">ALL</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">XBOX30</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PS3</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">Wii U</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">Wii</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PC</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">VITA</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PSP</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">DS</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> </ul> </div> </div> </div> I'm needing the first tab (the "ALL" tab) to be selected by default, but i don't have the first clue on how to do this. You can paste the code in notepadd++ and you can see what i mean. I have a welcome message on my site and would like to automatically hide it after several seconds. I can't find anything usable after searching over the internet. Can anyone help? Thanks in advance. How are you guys? Is there a possible thing? I've got 16 pages, one for each of 16 days. Then I've got index page. Where will be mine usual stuff but I want to add 16 visible buttons and under each button will be its content, let say for example a picture with some text. I need automatically when user open mine index for example 3rd to show 3rd picture with some text. Is that possible? To be more specific. I need some content to be automatically changed from 1st of January 2010 to 17th of January 2010. Is there some javascript that will make a link in a page be clicked on page load?
I have a lightbox pop up on my homepage. I'm curious if there's a way to automatically close the pop up after 5 seconds or so. For some readon onClose kept popping in my head, but I'm pretty sure that's not correct. Thanks. 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>Lightbox Example</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="/lightbox/ jquery.mousewheel-3.0.4.pack.js"></script> <script type="text/javascript" src="/lightbox/ jquery.fancybox-1.3.4.pack.js"></script> <link rel="stylesheet" type="text/css" href="/lightbox/fancybox/ jquery.fancybox-1.3.4.css" media="screen" /> <script type="text/javascript"> $(document).ready(function() { $("a#onload").fancybox({ 'frameHeight': 390, 'frameWidth': 640, 'hideOnContentClick': false, 'easingIn': 2000 }).trigger('click'); }); </script> <div id="lightbox_content" style="display:none"> <div id="data"> <img src="/lightbox/donate.jpg" alt="Support Today!"> <h1>Pledge Your Support Today!!</h1> </div> </div> <a id="onload" href="#data"></a> </body> </html> Hi,
I have a form in my site.when the form is submit successfully it's go to another page, which shows "submission is success".
and that page has a link to go back to a page which is viewing previously(before to form)
this is the code for it Code: <a href="javascript:history.go(-2)">Go back to previous</a> I want to know, how to go to previous page by automatically ??? this should be happen after 10 seconds! please help me.... Hi, I am trying to write a script to get my sprite to move to the next row once it reaches the last frame on it's current row. Here's my attempt so far; in the code below I want bird2 when it reaches frame 3 and spState(1) - this means first row - to switch to spState (2) second row. Code: if ($('#bird2'['current_frame']) == 3 && $('#bird2').spState(1)) { $('#bird2').spState(2); } else { $('#bird2').spState(1); } Here's the code regarding the spState() Code: spState: function(n) { $(this).each(function() { // change state of a sprite, where state is the vertical // position of the background image (e.g. frames row) var yPos = ((n - 1) * $(this).height()) + 'px'; var xPos = $._spritely.getBgX($(this)); var bp = xPos + ' -' + yPos; $(this).css('background-position', bp); }); return this; this is from http://www.spritely.net/ you will notice on this site that if you drag the slider to the left the bird sprites change direction, in fact they play the second row of frames. The reason I want my bird sprite to go automatically to the next row is because I am using video turned into individual frames and a png strip, and I am limited by the max width of png (8192px). see http://www.cranihum.com/ scroll down to see the bird on the rooftop. Each frame in that bird sprite is 80px wide and there are 93 frames. So I would like to include multiple rows to allow me to increase the number of frames. Up to 15 rows will be needed and after the last row it should go back to the first row. Perhaps a switch statement would be better than what I currently have. I am new to JavaScript and have been trying to pick up clues from http://www.w3schools.com I am very happy to learn and I hope to be prompted and pushed in the right direction. I hope my request is clear, please ask questions if not. Thank you Will Does anyone know of a good library/function that will add the commas to a number automatically as the number is entered into a field?
|