JavaScript - Javascript Doesn't Execute Page Refresh In Ie8
FF, Safari, Opera all execute this javascript code to refresh the page properly, but in IE version 8.0.6001.18904 the page doesn't seem to refresh on click of orange_refresh button. I have checked out a different version of IE8, don't recall exact version, but it did seem to work fine in that one, whatever version it was probably the latest now that I think of it. Check out code below any sug.'s could be helpful, though its probably a bug..
Code: <a href="javascript:document.location.reload();" onmouseover="window.status='Refresh'; return true" onmouseout="window.status='Page Refreshed'"><img src="image/orange_refresh.png" width="30" height="30" border="0" /></a> Similar TutorialsMost of the Javascript I see has some sort of time limit on page reload and is not really what I am trying to accomplish: Code: <meta http-equiv="Refresh" content="10; URL=http://coffeeandtealtd.com/buynow.html" /> I am trying to make our buy page reload after clicking the Paypal "continue shopping" button in Paypal Website Standards. The pop up Paypal shopping cart window closes after clicking the button but our buy page doesn't reload. It doesn't reload in Safari although it seems to be fine in FF and IE. I am new to javascript coding and am not quite sure how to make the page reload in this specific instance only. Any sug's?? Quote: Originally Posted by mlseim hmmm .... sort of stumped. For a test, I made a script that pulls a random "bumper-sticker" quote out of a file and sends it back as Javascript. Put this on a test page of yours and see what happens: <script type="text/javascript" src="http://www.catpin.com/bumper_sticker3.php"></script> Wherever that line is, when you view your web page, it should have a random quote. It's using the same code that I had above (in post #2). how would you put <script type="text/javascript" src="http://www.catpin.com/bumper_sticker3.php"></script> into a function for javascript to call this php file? First off; i was in two minds if this belonged in the .php forum or the javascript forum; i apologize if i chose the wrong one. I have this .php code: PHP Code: <?php $query = "SELECT mail_id FROM ".TBL_MAIL." WHERE UserTo = '$session->username' and status = 'unread'"; $numUnreadMail = $database->query($query) or die(mysql_error()); $numUnreadMail = mysql_num_rows($numUnreadMail); if($numUnreadMail == 0){ echo '<img src="../images/global/mail_imgs/inbox_0.png" width="22" height="15" />';} if($numUnreadMail == 1){ echo '<img src="../images/global/mail_imgs/inbox_1.png" width="22" height="15" />';} if($numUnreadMail == 2){ echo '<img src="../images/global/mail_imgs/inbox_2.png" width="22" height="15" />';} if($numUnreadMail == 3){ echo '<img src="../images/global/mail_imgs/inbox_3.png" width="22" height="15" />';} if($numUnreadMail == 4){ echo '<img src="../images/global/mail_imgs/inbox_4.png" width="22" height="15" />';} if($numUnreadMail == 5){ echo '<img src="../images/global/mail_imgs/inbox_5.png" width="22" height="15" />';} if($numUnreadMail == 6){ echo '<img src="../images/global/mail_imgs/inbox_6.png" width="22" height="15" />';} if($numUnreadMail == 7){ echo '<img src="../images/global/mail_imgs/inbox_7.png" width="22" height="15" />';} if($numUnreadMail == 8){ echo '<img src="../images/global/mail_imgs/inbox_8.png" width="22" height="15" />';} if($numUnreadMail == 9){ echo '<img src="../images/global/mail_imgs/inbox_9.png" width="22" height="15" />';} if($numUnreadMail == 10){ echo '<img src="../images/global/mail_imgs/inbox_10.png" width="22" height="15" />';} if($numUnreadMail == 11){ echo '<img src="../images/global/mail_imgs/inbox_11.png" width="22" height="15" />';} if($numUnreadMail == 12){ echo '<img src="../images/global/mail_imgs/inbox_12.png" width="22" height="15" />';} if($numUnreadMail == 13){ echo '<img src="../images/global/mail_imgs/inbox_13.png" width="22" height="15" />';} if($numUnreadMail == 14){ echo '<img src="../images/global/mail_imgs/inbox_14.png" width="22" height="15" />';} if($numUnreadMail == 15){ echo '<img src="../images/global/mail_imgs/inbox_15.png" width="22" height="15" />';} if($numUnreadMail == 16){ echo '<img src="../images/global/mail_imgs/inbox_16.png" width="22" height="15" />';} if($numUnreadMail == 17){ echo '<img src="../images/global/mail_imgs/inbox_17.png" width="22" height="15" />';} if($numUnreadMail == 18){ echo '<img src="../images/global/mail_imgs/inbox_18.png" width="22" height="15" />';} if($numUnreadMail == 19){ echo '<img src="../images/global/mail_imgs/inbox_19.png" width="22" height="15" />';} if($numUnreadMail == 20){ echo '<img src="../images/global/mail_imgs/inbox_20.png" width="22" height="15" />';} //Middle Section echo '</a> <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">'; if($session->isAdmin()){ echo '<a href="http://localhost/admin/admin_mailinbox.php">View Inbox ';} else{ echo '<a href="http://localhost/mailinbox.php">View Inbox ';} //Displays the correct number on drop tab if($numUnreadMail == 0){ echo ' ';} if($numUnreadMail == 1){ echo '(01)';} if($numUnreadMail == 2){ echo '(02)';} if($numUnreadMail == 3){ echo '(03)';} if($numUnreadMail == 4){ echo '(04)';} if($numUnreadMail == 5){ echo '(05)';} if($numUnreadMail == 6){ echo '(06)';} if($numUnreadMail == 7){ echo '(07)';} if($numUnreadMail == 8){ echo '(08)';} if($numUnreadMail == 9){ echo '(09)';} if($numUnreadMail == 10){ echo '(10)';} if($numUnreadMail == 11){ echo '(11)';} if($numUnreadMail == 12){ echo '(12)';} if($numUnreadMail == 13){ echo '(13)';} if($numUnreadMail == 14){ echo '(14)';} if($numUnreadMail == 15){ echo '(15)';} if($numUnreadMail == 16){ echo '(16)';} if($numUnreadMail == 17){ echo '(17)';} if($numUnreadMail == 18){ echo '(18)';} if($numUnreadMail == 19){ echo '(19)';} if($numUnreadMail == 20){ echo '(20)';} ?> which displays in this navigation: <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()" class="link_image"> <?php include_once('../include/mailicon_codes.php'); ?> </a> I wondered how or if it is even possible to use javascript to execute the first .php code so that the user would know if he/she had a new message without refreshing the page? Any help is greatly appreciated as i suck at .js cheers, Callum I am sorry if this is a stupid question. I have never really used javascript before. I found some code online that I tried to piece together so I might not even be going about this the right way. I want the background to take up 100% and resize with the browser. That works fine. I also want the text "welcome to the ahi life" stick to the bottom left hand corner and the enter button to stick to the bottom right. I would like these to resize with the browser as well. It all kind of works, except the first time you load the page the text and the button are much smaller than I would like them to be. If you refresh the page everything is correct. The url is http://www.ahiapparel.com/landing.html Code: <style> * { margin: 0; padding: 0; } #bg { position: fixed; top: 0; left: 0; } .bgwidth { width: 100%; } .bgheight { height: 100%; } #page-wrap { position:absolute; bottom:0; left:20px; width: 700px; margin: 50px auto;} #welcometext { position: fixed; bottom: 20px; left: 25px; } .welcometextwidth { width: 7%; } .welcometextheight { height: 7%; } #entertext { position: fixed; bottom: 20px; right: 25px; } .entertextwidth { width: 7%; } .entertextheight { height: 7%; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(function funct1() { var theWindow = $(window), $bg = $("#bg"), aspectRatio = $bg.width() / $bg.height(); function resizeBg() { if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { $bg .removeClass() .addClass('bgheight'); } else { $bg .removeClass() .addClass('bgwidth'); } } theWindow.resize(function() { resizeBg(); }).trigger("resize"); }); $(function funct2() { var theWindow = $(window), $welcometext = $("#welcometext"), aspectRatio = $welcometext.width() / $welcometext.height(); function resizewelcometext() { if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { $welcometext .removeClass() .addClass('welcometextheight'); } else { $welcometext .removeClass() .addClass('welcometextwidth'); } } theWindow.resize(function() { resizewelcometext(); }).trigger("resize"); }); $(function funct3() { var theWindow = $(window), $entertext = $("#entertext"), aspectRatio = $entertext.width() / $entertext.height(); function resizeentertext() { if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { $entertext .removeClass() .addClass('entertextheight'); } else { $entertext .removeClass() .addClass('entertextwidth'); } } theWindow.resize(function() { resizeentertext(); }).trigger("resize"); }); </script> My best guess is that either the functions or some of the variables are conflicting somehow, but I have tried just about everything to fix it. Any help would be much appreciated. Thanks! when I upload a new javascript file to the server and refresh the webpage, the webpage behaves as if the old script is on the server, this happens with IE and firefox, even if I shut the programs down and restart them, can anyone help? Hello Friends In my jsp,Struts project i am using the javascript calendar control for selecting the date and by using function calcage() i am calculating the age of the user but problem occurs when the page refreshes OR when user updated the other values such as name ,contact no. Then the value of the age is set as 0 in the textfield as 0 So can you please tell me why this problem occurs And please give me solution Thanks i'm working with a city select option, a hotel select option & an iframe. the hotel select option is populated depending on the chosen city which then updates the iframe src. this is all working fine. the trouble im having is that when the page is refreshed, normal f5 way, the hotel option changes whereas the city option & the iframe src remains the same?? this problem does not occur on a force refresh via control + f5 as then both select options & iframe src revert to their original state. I don't want the city option to change upon a normal page refresh. how do I go about this? below are the city, hotel select options & iframe Code: <form name="hotelslist" id="hotelslist"> <select id="cities" name="cities" onChange="hotel_list(hotelslist.cities.selectedIndex);loadHotel();"> <option value="Baddeck">Baddeck</option> <option value="Banff">Banff</option> </select> <select id="hotelnames" name="hotelnames" onChange="loadHotel();"> <option value="Inverary Resort, Baddeck">Inverary Resort, Baddeck</option> </select> </form> <iframe name="hotelframe" id="hotelframe" src="http://www.google.com" scrolling="no" width="660" height="1000" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0"> <p>Your browser does not support iframes.</p> </iframe> below is my javascript functions Code: function loadHotel() { var destURL = document.hotelslist.hotelnames.options[document.hotelslist.hotelnames.selectedIndex].value; window.frames["hotelframe"].location = destURL; } var i; function hotel_list(i){ var hotelslist = document.getElementById("hotelslist"); hotelslist.hotelnames.options.length=0; switch(i) { case 0: //Baddeck hotelslist.hotelnames.options[0] =new Option('Inverary Resort, Baddeck','http://www.test0.com'); break; case 1: //Banff hotelslist.hotelnames.options[0] =new Option('Banff Caribou Lodge & Spa','http://www.test1.com'); hotelslist.hotelnames.options[1] =new Option('Banff Ptarmigan Inn','http://www.test2.com'); hotelslist.hotelnames.options[2] =new Option('Banff Rocky Mountain Resort','http://www.test3.com'); hotelslist.hotelnames.options[3] =new Option('The Rimrock Resort','http://www.test4.com'); hotelslist.hotelnames.options[4] =new Option('Fairmont Banff Springs','http://www.test5.com/'); break; } } can some one please advise on a cross browser solution? thanks in advance. Omar. I have a php file lets say file1.php, that printing a variable, its dynamic numbers output that already always increasing, like private message numbers that coming or others : PHP Code: <?php echo $variable ?> i want to put that variable output, in another files page title, lets say file2.php or file3.html, in the front of the another files page titles, and auto refresh every x seconds, maybe like this : Quote: (1) - another text in the page title after x seconds, get a private message Quote: (2) - another text in the page title after another x seconds, get another private message Quote: (3) - another text in the page title or its ok if just like this, only the variable, without the another text in the page title Quote: (1) please share your knowledge to make it, maybe using javascript, jquery or others Voting button on the poll in the left column works fine if you take the sharethis javascripts out. Why won't they work together though? <script type="text/javascript" src="http://www.claimsheaven.co.uk/polls/admin/script.js"></script> <script type="text/javascript">var switchTo5x=true;</script> <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> <script type="text/javascript" src="http://s.sharethis.com/loader.js"></script> e.g. on this page: http://www.claimsheaven.co.uk/news/20120305.php I am wondering if its possible to execute a JavaScript script as soon as the page is loaded? Perhaps a generic execution? I tried this, but it didn't work: Code: <SCRIPT type="text/javascript"> if (document.forms["form"]["quantitym"].value > '.$row['sizem'].') { alert ("The quantity for product $row['id'] is no longer available."); } </SCRIPT> <FORM action="updatecart.html" method="post" name="form"> <DIV> <B>Medium:</B> <INPUT name="quantitym" value="'.$content['sizem'].'"> </DIV> </FORM> This is for my shopping cart system. The idea is, the customer might have 4 items in his cart, but whilst he was shopping, someone might of bought the same item, result in only 3 being available, but his cart still says 4. My solution to this is to make a script run through out his shopping when ever the cart items are listed and just prior payment execution, if the quantity he wants is no longer available, he will be alerted. $row['sizem'] is PHP drawing how many items there are from my stock database. If the value of the INPUT exceeds this availability, JavaScript shall alert. Does anyone know why it isn't alerting? I wish to change the dynamic text in a javascript to that which is in a MySQL database using PHP. this is then used in a flash scroller. currently i have hard coded the text in the javascript file. is there a way to have PHP run in the javascript file before it is sent to the endusers? or another way ? Hi, I'd like to create a textarea and a division so that whatever embed code you put in the textarea it gets executed on the division in real-time. Your kind help is greatly appreciated! JavaScript newbie Hi, I'm doing something wrong, I want my script to execute when the browser window opens, can someone please help me? Code: <p><iframe id="myFrame" style="display: none;" width="500" height="300"></iframe> <script type="text/javascript">// <![CDATA[ window.onload=openpdf(); type="text/javascript">// <![CDATA[ function openPdf() { var omyFrame = document.getElementById("myFrame"); omyFrame.style.display="block"; omyFrame.src = "myFile.pdf"; } // ]]></script> Hey all, so im working on a piece of jquery/JS which executes (drops down a new div) when you click a link. I have the links setup as <a href="#" id="d0">Execute 1</a> <a href="#" id="d1">Execute 2</a> <a href="#" id="d2">Execute 3</a> And the jscript detects when d0, d1 or d2 is clicked and executes my script. It all works perfectly, however when you click on a link it will jump to the top of the page as a side effect of the a href="#" I assume? Is there anyway to have my same effect work inline (without jumping the page to the top) ? Thank you very much! HI peers, i need to run a sql query fromjavascript onclick button and display data in a textarea . is this possible ? than you . i have a page named pck_rates.php which contains a form that go to the page update_pck_rates.php when i press updade data button in the second page i want the first page to be refreshed to show the new data's. i want to know if i can set a name to the page pck_rates.php and after the update query in the second page i will refresh the pck_rates.php page using this name?? i don't know what is the function and how to make this idea. can anyone help me please Is this possible? I am writing a script that will display an alert box that reads "your play was saved" after a user clicks the submit button on a form. The only problem is that after clicking save, the page refreshes. Here is the code I tried to use Code: function savedMessage(){ document.getElementById("CmdFinish").addEventListener("click",function(e) { GM_setValue("Saved", 1); }, false); if (GM_getValue("saved", 0) == 1) { alert("Your play has been saved"); GM_setValue("saved", 0); // or GM_deleteValue("saved"); } } The button ID is "CmdFinish" and the value is "saved". Is there ANY way i can make the script run only on a page refresh? **Note** The script is for a specific page and not the whole site, so it wont run on every refresh on the site, only when it's needed on 1 page. <HEAD><TITLE>main</TITLE> <meta http-equiv="refresh" content="5;url=http://localhost/php_basic/short_pro/php/main.php"> <!--<script language="JavaScript"> var i=0; function validat() { setTimeout("moretext()",5000); alert("santosh"); } function moretext() { if(i==0) { alert(window.location); window.location.reload(); i++; } else { } } </script>--> </head> <BODY onload="validat();"> i hav written dis code to auto refresh page only once but it is refreshing after every 5 seconds. Earlier i hav wriiten meta tag but it is refreshing page after every 5 seconds & after that i hav wriiten script to auto reffresh page only once but they both r doin the same work,so can u plz help me in solvin my problem How can I write a JavaScript for the following requirement. I have to go to a link say
Quote: www.google.com and refresh it for every 5 seconds continuously. Thanks |