Hello. I have one question. I have a form which I wish to clear all fields upon refresh/reload (*except one field*). Using onload and onunload, all fields are cleared but I need to retain one field upon a User doing this action. Is there a method where I can perhaps loop through all the fields, choosing those I wish to clear, and the one I want to retain? Thank you in advance for any assistance or advice. Matthew

Member Avatar
Member Avatar
+0 forum 8

Hello good people. I am trying to add a snippet of javascript to the head tag of a mobile site that checks if the visitor is using a PC and if the visitor is viewing the mobile site on a PC I want them to be redirected to the normal site. The following code snippet is the best I could come up with. I am not too well versed in javascript but I thought I was close. This code SHOULD check the user's screen width and if it is greater than a certain value then it will promt to the …

Member Avatar
Member Avatar
+0 forum 4

It seems to me that the Audio object can not be easily played inside a JavaScript callback when running on a mobile device. The code below shows an onload function which, on a PC, plays the sound when the web page is loaded, but on Android phones plays nothing. My uninformed guess is that the callback returns before the Audio object starts to play, and thus, for some deep reason, dies. Is there any way over this? In the full version the JavaScript would read the sound to play from the URL. <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Play …

Member Avatar
Member Avatar
+0 forum 1

Hi, I thought I'd share this with you. If you want all fields on a web form to be emptied of ther initial value (if any) on focus and filled again with the initial value on blur. Works with jquery.

Member Avatar
Member Avatar
+0 forum 1

My button uses the following. It produces a random post within my blog whenever a user clicks it. <div id="myLuckyPost" class="random button"></div><script type="text/javascript"> function showLucky(root){ var feed = root.feed; var entries = feed.entry || []; var entry = feed.entry[0]; for (var j = 0; j < entry.link.length; ++j){if (entry.link[j].rel == 'alternate'){window.location = entry.link[j].href;}}} function fetchLuck(luck){ script = document.createElement('script'); script.src = '/feeds/posts/summary?start-index='+luck+'&max-results=1&alt=json-in-script&callback=showLucky'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); } function feelingLucky(root){ var feed = root.feed; var total = parseInt(feed.openSearch$totalResults.$t,10); var luckyNumber = Math.floor(Math.random()*total);luckyNumber++; a = document.createElement('a'); a.href = '#random'; a.rel = luckyNumber; a.onclick = function(){fetchLuck(this.rel);}; a.innerHTML = '<center><span id="icon-random"></span></center><span class="visible-lg">Random</span>'; document.getElementById('myLuckyPost').appendChild(a); } </script> …

Member Avatar
Member Avatar
+0 forum 8

trying to make this script work: <script type="text/javascript"> var tmp='<html><head><title>popup</title>'; tmp+='<script type=text/javascript>'; tmp+='function nowTime(){'; tmp+='var oNowTime=new Date();'; tmp+='var iMonth=oNowTime.getMonth();'; tmp+='var iDate=oNowTime.getDate();'; tmp+='var iYear=oNowTime.getFullYear();'; tmp+='var iHours=oNowTime.getHours();'; tmp+='var iMinutes=oNowTime.getMinutes();'; tmp+='var iSeconds=oNowTime.getSeconds();'; tmp+='var iMilliSeconds=oNowTime.getMilliseconds();'; tmp+='var sNowTime=iHours+":"+iMinutes+":"+iSeconds;'; tmp+='return sNowTime'; tmp+='}'; tmp+='function nowDate(){'; tmp+='var oNowTime=new Date() '; tmp+='var iMonth=oNowTime.getMonth()+1'; tmp+='var iDate=oNowTime.getDate()'; tmp+='var iYear=oNowTime.getFullYear()'; tmp+='var iHours=oNowTime.getHours()'; tmp+='var iMinutes=oNowTime.getMinutes()'; tmp+='var iSeconds=oNowTime.getSeconds()'; tmp+='var iMilliSeconds=oNowTime.getMilliseconds()'; tmp+='var sNowTime=iYear+"-"+iMonth+"-"+iDate;'; tmp+='return sNowTime'; tmp+='}'; tmp+='function showNowTime(){'; tmp+='var oObjId1=document.getElementById("mdate");'; tmp+='oObjId1.innerHTML=nowDate();'; tmp+='var oObjId2=document.getElementById("mclock");'; tmp+='oObjId2.innerHTML=nowTime();'; tmp+='setTimeout("showNowTime()",1000)'; tmp+='}'; tmp+='<\/script></head><body onload="showNowTime()">'; tmp+='<font size="7">'; tmp+='<div id="mdate">mdate</div>'; tmp+='<div id="mclock">mclock</div>'; tmp+='</font></body></html>'; var newwindow2=window.open('','name','height=200,width=150'); newwindow2.document.write(tmp); </script> What's Wrong ?? any suggestions are welcomed. thanks

Member Avatar
Member Avatar
+0 forum 5

Hi In my application I have a test for distance using google maps api. As you can see above if the postcode is within range the page is redirected to the menu page. I have created a very simple lightbox using css and the onclick function. I want that div/lightbox to be opened in the else section. I have tried different methods such as window.show, getElementById(light).style.visibility="visible" and a few other things! Any help would be great thank you. if (results[0].distance.value <= 9828 ) { setTimeout("window.location = 'menu'",3000); }else{ } } }

Member Avatar
+0 forum 0

I am trying to create a webpage which does the following: 1)Has an image,which has an onclick javascript function f1() and an image map with a link pointing to a javascript function f2(); 2)updateAnim() is an "animation" it changes the image sources some 30 times 3)f2() is any function(trying with alert right now. It seems simple enough,but as soon as f2() executes, the image goes back to its original source. Now I have been at this for quite a long time..I have tried a number of quickfixes from changing source and onload in f1 to adding an onload function that …

Member Avatar
Member Avatar
+0 forum 4

Hey guys! was wondering if anyone knows anything about how to make a popup appear with an image as soon as the page loads.. lots of sites have this and i couldnt find it anywhere on google.. im pretty sure it can be done with java but i may need some help. thanks :D

Member Avatar
Member Avatar
+0 forum 1

this is my as2 code , i m trying to get variable t outside the onload function but failed , somebody help me !!! [CODE]$i=0; myData = new LoadVars() myData.load("http://localhost/exercise/"+$i+".php") myData.onLoad = function(succes) { if(succes){ var t:Number =myData.total_pages; a.text=myData.t1 b.text=myData.t2 c.text=myData.t0 tp.text=t } else trace ("Error loading data") } next_.onRelease = function() { $i++; if($i<=t) { submitDataToTextfile(); trace(t) // this is not working } } [/CODE]

Member Avatar
+0 forum 0

We currently have a system that display multiple sections on one page when it loads. What we were looking at doing is breaking each section into an expandable/collapsable group that is controlled by the end user with all groups collapsed on load by default. In saying that, is there a way to have it load the section [B][U]ONLY[/U][/B] when expanded to avoid having all the queries run to load the individual sections? To explain it another way, we have an ASP page that is set to up to query and load all sections displayin on the page, so we have …

Member Avatar
Member Avatar
+0 forum 1

HI all, Normally I've been lucky to find someone who has had the same problem and applied their solution but after hours of searching I'm not able to find a solution to this one. I've got a FormView which is default mode set to Insert. When the page is loading I'm checking to see if the session variable which the formview datasource is set to has a value. If it doesn't I've coded in the onLoad that some of the controls in the InsertTemplate would be set to specified value. The code works but when the page finally renders the …

Member Avatar
Member Avatar
+0 forum 1

I want to be able to open a window with a variable. For example, I will use domain.com?reference=1234- This link will open a pop up window as follows: [CODE]<a href="javascript:popUp('http://www.domain.co.uk/staff/tpr/update_action_log.php?action_reference=<?php echo $row2['action_reference']; ?>')" title="Click Here edit this entry"><?php echo $row2['action_reference']; ?></a>[/CODE] When I open this window, it is always showing data put in last, it isnt refreshed. I wanted to open this pop up window, enter data and then click submit and make the data enter the database and then refresh the parent window. Every time I have done this, either the parent or the pop (or both) is showing …

Member Avatar
Member Avatar
+0 forum 10

Hi javaAddicts I am a novice java programmer. I am in a learning process in java servlets. How to load a servlet and invoke its method from index.jsp. I want the servlet to execute first and dispatch its value to index.jsp and also i dont want to use redirect from jsp and again dispatching the values from servlet. Is there is a way to access it.

Member Avatar
Member Avatar
+0 forum 3

Hi everyone, i have a piece of javascript that calculates 2 input fields (price * qty) whenever i type in the input field (qty) that uses this : [CODE]onkeyup="update(this);"[/CODE] Now what i want is to execute this handling when the page loads, because sometimes there are already values (php & mysql) in the qty field, so the subtotal must already be there. Any thoughts on how to accomplish this? greetings piet!

Member Avatar
Member Avatar
+0 forum 10

Hello all! So I am creating a redirect page so that when someone signs up for our newsletter they're taken to this page and 10 seconds later, redirected to another page. The script I'm using isn't working for some reason. I originally had it in a seperate .js file but put it in the text to reference it more easily. Still nothing. Any ideas? [code] <html> <head> <link rel="stylesheet" href="../maiccss/index.css" type="text/css" media="screen"> <link rel="stylesheet" href="../maiccss/indexprint.css" type="text/css" media="print"> <title>MAIC Newsletter and Updates Subscription Form</title> <script language="JavaScript" type="text/javascript"> function timer { var goToTimer; goToTimer=setTimeout("goTo()",10000) <!-- After 10 seconds the page changes --> …

Member Avatar
Member Avatar
+0 forum 2

I tried to get as much info into the title as posible... hope it doesnt confuse anyone i have an initAll() called on window.onload within initAll() I assign a few onclick handlers to some links. However, it would be great if I could pass an argument to the handler, so I could use the same handler every time... but if I include two brackets for each handler, it executes immediately... ignoring the 'onclick' bit... [code] window.onload = initAll; function initAll(){ document.getElementById('btn_events').onclick = getSpecificFeed('events'); } function getSpecificFeed(type) { var url = make_abs('home','specific','feed=' + type); //special fn to create an absolute url …

Member Avatar
Member Avatar
+0 forum 2

The End.