JavaScript - Function Popup Problem
I'm back, I think i've been up working on my service library too long ,,i'm confused on this subject of popup windows or something.
Code: <html> <head> <script type="text/javascript"> function popUp(URL,Name) { var day = new Date(); var id = "page" + Name; window.open(URL, id, "toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=600,height=600"); var URL='https://www....com/'; } </script> </head> <body> <input type="text" <input type="button" onclick="javascript:popUp('Samsung_SB.asp?d=TRIAGE&SB='+'value')"> </body> </html> I'm lost where the text field comes into play..what i'm looking for is the following. input text in my case service bulletin doc number. which will then be appended to the end of the http addy after hitting enter and have the popup window open. I'm not gonna lie i have no clue as too what i'm doing Similar TutorialsHello everyone, I have a very strange situation here where Internet Explorer popup a new window on only one of my <a> elements. I created multiple <a> elements that do the following: Code: <a href = "javascript:popup('overview1.php?pID=<?php echo $pID;?>')"> <button class = "button" type="button">Overview </button></a> <a href = "javascript:popup('overview1.php?aID=<?php echo $FinalID[$key];?>')" style="float:right;"> <button type="button"><img src="image/Details.PNG" height="20px" width="20px"> </button></a> <a href="javascript:popup('cart.php?aID=<?php echo ... ?>)</button></a> <a href="javascript:popup('addnew.php')"> <button class = "NavButton" type="button">Add New</button></a> Out of the four buttons/link, only the first one is working properly (Open a new popup window) Below is my simple javascript code to open a window. Code: function popup(url){ cuteLittleWindow = window.open(url, "littleWindow", "location=no,width=1020,height=650");; cuteLittleWindow.focus(); } I have no idea why ie is acting like this and all the other major browsers work just fine with my code. Please let me know what you think is the issue and I greatly appreciate your help. Reply With Quote 01-28-2015, 11:44 PM #2 laytonsdad View Profile View Forum Posts New Coder Join Date Jan 2015 Location USA Posts 19 Thanks 0 Thanked 1 Time in 1 Post Are you receiving any errors in the console? Reply With Quote 01-29-2015, 01:21 AM #3 cheukyin91 View Profile View Forum Posts New Coder Join Date Nov 2014 Posts 17 Thanks 6 Thanked 0 Times in 0 Posts No. I also tried to output something on the console inside the function but it doesn't write to console as well. So I think ie doesn't even call the javascript function onclick. Please let me know what to do, thanks! Reply With Quote 01-29-2015, 01:25 AM #4 laytonsdad View Profile View Forum Posts New Coder Join Date Jan 2015 Location USA Posts 19 Thanks 0 Thanked 1 Time in 1 Post Originally Posted by cheukyin91 No. I also tried to output something on the console inside the function but it doesn't write to console as well. So I think ie doesn't even call the javascript function onclick. If the first one works this is not the case. Are you sure that the PHP is inserting correct information? Did you check for errors after the click has been done or just when the page is loaded? Do you have a live version to see? Reply With Quote 01-29-2015, 02:37 AM #5 felgall View Profile View Forum Posts Visit Homepage Master Coder Join Date Sep 2005 Location Sydney, Australia Posts 6,745 Thanks 0 Thanked 666 Times in 655 Posts Attaching JavaScript to the href attribute produces unknown results. It never triggers an event and so regular JavaScript event processing doesn't work. In this instance the browser's popup blocker is expecting the request to open a new window to originate with a user event and so blocks the request because there is no event. Instead of: Code: <a href = "javascript:popup('overview1.php?pID=<?php echo $pID;?>')"> <button class = "button" type="button">Overview </button></a> use the following in the HTML Code: <button id="overview1" class="button" type="button">Overview</button> and in a <script> tag attached just before the </body> tag insert the following line of code: Code: document.getElementsById('overview1').onclick = function() {popup('overview1.php?pID=<php echo $pID;?>'); Repeat the change for the other buttons (you only need the one script tag wrapped around all the JavaScript). Hey everyone, I have a javascript problem which I think can be resolved by adding a few lines of code. I will try to explain my situation: Code: <img title='gameplay0001' class='popuplink' src="img/visual/gameplay/visual-gameplay-10.png"/>\ <span class='popup'> <span>gameplay0001</span> <img src="img/visual/gameplay/visual-gameplay-10_large.png" /> <div class='clear'></div> <div class='popupclosebtn'>back</div> </span> this javascript I wrote, allows me to do this: 1) I click on the element with class .popuplink 2) The span with the class popup that contains a span whose text equals the title of popuplink (in this case gameplay0001) appears 3) when I click popupclosebtn the popup closes this is all done by the next javascript: Code: $('.popuplink').each(function() { $(this).click(function() { var source = $(this).attr('title'); var popupContent = $(".popup:contains('" + source + "')"); var popupContainer = $("#popcontainerbase"); popupContainer.html(''); popupContainer.html(popupContent.html()); $("#popcontainerbase").fadeIn(200, function() { $('.popupclosebtn').click(function() { var popupContainer = $("#popcontainerbase"); popupContainer.html(''); $('#popcontainerbase').fadeOut(200, function() { }); }); $(document).keyup(function(e) { if (e.keyCode == 27) { var popupContainer = $("#popcontainerbase"); popupContainer.html(''); $('#popcontainerbase').fadeOut(200, function() { }); } }); }); }); }); Oh by the way, I put all the .popup content in a div called #popupcontainer, so my content won't affect my relative container div. So, this works perfect, text and images can be placed in the span .popup; no proplems. Additionally, I also have a jwplayer in my website. This works fine as well. With one exception: When I try to put a jwplayer video into a .popup window, IE fails to put the video in there. it just ignores it. My video popup page: Code: <img title='trailer01' class='popuplink' src="img/visual/trailer01.png"/> <span class='popup'> <span>trailer01</span> <div id="trailer01"> </div> <div class='clear'></div> <div class='popupclosebtn'>back</div> </span> The javascript source on the bottom of the page: Code: jwplayer("trailer01").setup({ controlbar:"over", "controlbar.idlehide": false, controlbar:"bottom", autostart: true, flashplayer: "jwplayer/player.swf", skin: "jwplayer/skins/glow.zip", wmode: "transparent", file: "video/trailer01.mp4", width: 490, height: 340 }); so, that is my situation. This script will not work in internet explorer. Can anyone tell me how to fix this? thanx in forward hey, i have a link in js file , with innerHTML. everything works fine, but i want to make the link in a popup window. now its look like this : Code: innerHTML = "<a href='http://tamarp.someee.com/test.php?code="+row[curr].name+"&name="+row[cur].real+"'>ADD</a>"; how do I make this link to be in POPUP? what should i add here? thanks Hi, I have a code that opens a new window from a flash movie. The window opens fine, but the parent window goes blank and displays this on the top left of the screen: [object] (in IE8) [object Window] (in Firefox) Does anyone know what I'm missing? This is the code for the button that opens the new window: on (release) { getURL ("javascript:window.open('/RG_Map.pdf','RGCommunityMap','width=700,height=700');"); } I re-wrote this code to display an exit notice alert and open a new window after user confirms they wish to leave the website. However, something is wrong with my code below. The alert and cancel alert works fine, but my new window link does not appear. I was curious if i could get some help fixing this code from anyone in the JavaScript programming forum. See code: <script language='JavaScript'> function ExitNotice() { if(confirm("You are now leaving the web site. To leave our site for the link you selected, click OK. Or Click Cancel to remain. Thank you for visiting our site.")) { return true; } history.go(0); return false; } </script> Now for my button code that appears later inside my form which opens a sized window. <input id="btnView" class="MyButton" type="button" onclick="ExitNotice('http://www.google.com', null, 'left=40,top=100,height=550,width=780, status=no,toolbar=no,menubar=no,location=no, resizable=yes, scrollbars=yes')" name="btnView" value="View Web Site" /> Please test and advise what i'm missing... thanks in advance as i eagerly wait for a solution that fixes this issue. Hai.. I am using the popup :http://www.javascripttoolbox.com/lib...bined/popup.js The command for showing popup: Popup.show('contentDiv', 'targetDiv',"above left",{'constrainToScreen':true, 'autoHide':false}); Without 'autoHide' property i can use the command: Popup.hideAll(); for closing popup, But when i am using this 'autoHide' property, how can i close the popup?? Popup.hideAll(); is not working with me....... please help me.. Hi , Pls solve it Javascript problem. I have a page called gallery.html in which we have photo albums.when u click on one of the photo albums opens up all images belongs to that album on same page ( javascript). when click on one of the images it has to open up in a popup ( including other images) which is happening but the probleem is that when u close popup and again click on same images popup is happening but images are not loading. what might be the problem ..pls solve it .......its too urgent thanks in advance nagaraja kharvi Hi everybod, i have on my website http://www.musi9a.coma flash mp3 player that opens in a popup. The user can then add songs to it by clicking on a link "add song". When the popup is already open and the user is on the same page the if(popup) or if (popup && popup.open) works but when the user navigates to other pages if(popup) doesnt seem to work anymore. can you help me. You can test on my website choose an artist click on "launch top 30" or "launch all" then go to another artist. You will notice that you have to click twice to get it work (the playlist in the player will change). Any general improvements are also welcome. ty in advance Hi and thanks for taking the time to help me. Just to say in short, I'm a musician and not a programmer, the only thing I have learned is html many years ago, however JS and Java I have never done at all. About 6 month ago I asked a colleague of mine to make me a new website. All went very nicely apart from one little detail as the title says. The popup window with the music player (me playing), keeps on going in the background as soon as a person continues to browse through the page. Unfortunately, my colleague hasn't answered any of my emails asking him to fix it, and therefore I found this forum through google with hope that perhaps you'd be able to help me out. I have found the part of the code that shows the function to open a new window (in the <head></head> part of the page). Here it is: <code> <SCRIPT LANGUAGE="javascript"> <!-- function otworz(adres) { noweOkno = window.open(adres, 'okienko', 'menubar=no, toolbar=no, location=no, scrollbars=auto, resizable=yes, status=no, width=270, height=260, left=30, top=30') noweOkno.focus() } --> </script> </code> Here is the part which is already in the <body> of the page <code> <a href="javascript:otworz('muzyka.htm')"><img src="muzyka.png"></a> <!-- <object type="application/x-shockwave-flash" id="player1" allowscriptaccess="always" allowfullscreen="false" data="OriginalMusicPlayer.swf" width="170" height="90"><param name="movie" value="OriginalMusicPlayer.swf" /><param name="FlashVars" value="playlistXmlPath=music/playlist.xml" /></object> --> </code> My colleague is Polish and hence the Polish language of the function and the htm file. If it would be more usefull for you to see the actual website, then I can of course give you the adress as well, but perhaps the code above would do. In any case, I thank you for any help or advice you can give me. Greetings Daniel I've written a javascript class that displays a popup, but as soon as the code executes the popup vanishes. I've stepped through the code, line by line and there's nothing that "hides" the popup, the DIV that is created by the class, just reverts back to the default configuration generated by the following function: Code: function generateMarkup() { //build markup var newNode = document.createElement( 'DIV' ); newNode.id = IDs.HelpPopup; newNode.style.visibility = 'hidden'; newNode.innerHTML = [ '<div id="popup">', '<div id="inside">', '</div>', '</div>' ].join( '' ); return newNode; } All the changes made to the DIVs via document.getElementById code is completely wiped out. For example: Code: document.getElementById("inside").innerHTML = sText; If I stop processing just before the Class returns to the form, the generated code is exactly as I expect it to be with all the dynamic modifications. The class is triggered by an onClick event on a BUTTON. I've tried to put a "sleep" function in after executing the function that modifies the DIVs, but that seems to execute before the function, not after, so the popup just flickers into existence and then vanishes. Can anyone give me any hint(s) as to how to stop this happening. Hi I have faced popup window resizable problem in Safari. When I resize that popup window its resizing. When I used this code window.open('chat.html','Test','width=230px,height=405px,location=no,status=no, menubar=no,toolbar=no,r esizable=false ,scrollbars=no'); Please any body help unresizing popup window. Thanks In advance Ruban Hi Everyone, I have the following problem that I have been trying to figure out for a few hours now and am hoping someone can give me a help out. I am opening a popup - this popup is solely to take an image url and as such has one field. On this 1st popup I have a 'button' which when clicked launches a 2nd popup window containing a file browser. The user selects the file by double clicking on the image they want, the url is passed back to the 1st popup, poulating the field and the 2nd popup is closed. Work perfectly in FF etc.. but in IE7 and IE8 it will not work. I am using the following function, linked to the button in the 1st popup, to open the 2nd popup window pass across the name of the field and the window object to the 2nd window. Code: function popupTwoInit(file_path, field_name, win) { var w = window.open(file_path, null, 'toolbar=yes,menubar=yes,width=900,height=600'); w.fileFileField = field_name; w.fileFileWin = win; } Where w is holding the window object created by the window.open, field_name is the name of the field on the popup that I wish to pass back a value to and win is the window object of the 1st popup. I am using this function as the callback to poulate the field in the 1st dialog after an image in the 2nd dialog has been selected: Code: filebrowser_callback(url) { window.fileFileWin.document.forms[0].elements[window.fileFileField].value = url; window.fileFileWin.focus(); window.close(); } So this function accesses the passed through window object and field name from the window.open function, populates the field, gives the 1st popup focus and closes the 2nd popup. I thought about using opener in the 2nd popup to access the window object and field in the 1st popup but opener seems to refer to the main page in the browser - perhaps because I am using 2 popups OR I have got that wrong. Like I say works perfectly in FF but IE is always undefined for both 'window.fileFileWin' & 'window.fileFileField' which seems to suggest that the object is not interpreted by IE in the first function? I am a PHP developer with limited Javascript knowledge so any help would be great. Thanks very much. <p> <script type="text/javascript">// <![CDATA[ var metrics = { "mm" : 1, "cm" : 10, "m" : 1000, "inch" : 25.4, "foot" : 304.8 }; function convert(num, dec){ var val = document.getElementById("fromVal").value; if(isNaN(val)){ return } function roundNumber(num, dec) { var result = Math.round( Math.round( num * Math.pow( 10, dec + 1 ) ) / Math.pow( 10, 1 ) ) / Math.pow(10,dec); return result; } document.getElementById("toVal").value = val * metrics[document.getElementById("fromSystem").value]/ metrics[document.getElementById("toSystem").value]; } var interval = null; function watchChanges(){ interval == null ? setInterval("convert()", 500) : clearInterval(interval); } // ]]></script> </p> <table> <tbody> <tr> <td><input id="fromVal" style="width: 100px;" onfocus="watchChanges()" onblur="watchChanges()" type="text" /><select id="fromSystem" onchange="convert()"> <option value="mm">millimeters</option> <option selected="selected" value="cm">centimeters</option> <option value="m">meters</option> <option value="foot">feet</option> <option value="inch">inches</option> </select></td> </tr> <tr> <td colspan="1" align="center">=</td> </tr> <tr> <td><input id="toVal" style="width: 100px;" type="text" disabled="disabled" /><select id="toSystem" onchange="convert()"> <option value="mm">millimeters</option> <option value="cm">centimeters</option> <option value="m">meters</option> <option selected="selected" value="foot">feet</option> <option value="inch">inches</option> </select></td> I have written this code but when i include code for pop calender in a row, then button was disabled, So please help me i just struck in this problem from last one week Thanking you, L.Rajesh rajboy13@gmail.com my code is Code: function addRow() { var tbl = document.getElementById('tblMed'); var lastRow = tbl.rows.length; var iteration = lastRow; var row = tbl.insertRow(lastRow); var cellLeft = row.insertCell(0); var sl = document.createElement('input'); sl.type = 'text'; sl.name = 'sln' ; sl.id = 'sln' + iteration; sl.value = iteration; sl.size = 3; sl.readOnly = true; cellLeft.appendChild(sl); var cellRights= row.insertCell(1); var elm= document.createElement('input'); elm.type = 'text'; elm.name = 'txtMdesc' ; elm.id = 'Mdesc' + iteration; elm.size = 20; cellRights.appendChild(elm); var cellRightt= row.insertCell(2); var elmn= document.createElement('input'); elmn.type = 'text'; elmn.name = 'txtMqty' ; elmn.onclick = "cal1xx.select(document.forms[0].sdate,'anchor1xx','dd-MM-yy'); elmn.id = 'Mqty' + iteration; elmn.size = 20; cellRightt.appendChild(elmn)"; var cellRightu= row.insertCell(3); var elmno= document.createElement('input'); elmno.type = 'text'; elmno.name = 'txtMbill' ; elmno.id = 'Mbill' + iteration; elmno.size = 20; cellRightu.appendChild(elmno); } the button code is : Code: </br> <fieldset style="width:60%;" align="center"> <legend> <SCRIPT LANGUAGE="JavaScript"> function deleteRow(b){ document.getElementById('table_formcontainer').deleteRow(b) } function CompareDates1() { var str1 = document.getElementById("start").value; var str2 = document.getElementById("edate").value; var dt1 = parseInt(str1.substring(0,2),10); var mon1 = parseInt(str1.substring(3,5),10); var yr1 = parseInt(str1.substring(6,10),10); var dt2 = parseInt(str2.substring(0,2),10); var mon2 = parseInt(str2.substring(3,5),10); var yr2 = parseInt(str2.substring(6,10),10); var date1 = new Date(yr1, mon1, dt1); var date2 = new Date(yr2, mon2, dt2); if(date2 < date1) { alert("To date cannot be greater than from date"); return false; } else { alert("Submitting ..."); document.form1.submit(); } return true; } function addRow() { var tbl = document.getElementById('tblMed'); var lastRow = tbl.rows.length; var iteration = lastRow; var row = tbl.insertRow(lastRow); var cellLeft = row.insertCell(0); var sl = document.createElement('input'); sl.type = 'text'; sl.name = 'sln' ; sl.id = 'sln' + iteration; sl.value = iteration; sl.size = 3; sl.readOnly = true; cellLeft.appendChild(sl); var cellRights= row.insertCell(1); var elm= document.createElement('input'); elm.type = 'text'; elm.name = 'txtMdesc' ; elm.id = 'Mdesc' + iteration; elm.size = 20; cellRights.appendChild(elm); var cellRightt= row.insertCell(2); var elmn= document.createElement('input'); elmn.type = 'text'; elmn.name = 'txtMqty' ; elmn.onclick = "cal1xx.select(document.forms[0].sdate,'anchor1xx','dd-MM-yy'); elmn.id = 'Mqty' + iteration; elmn.size = 20; cellRightt.appendChild(elmn)"; var cellRightu= row.insertCell(3); var elmno= document.createElement('input'); elmno.type = 'text'; elmno.name = 'txtMbill' ; elmno.id = 'Mbill' + iteration; elmno.size = 20; cellRightu.appendChild(elmno); } function delRow1(c) { document.getElementById('tblMed').deleteRow(c) } function validate() { var tbl = document.getElementById('tblMed'); var lastRow= tbl.rows.length-1; var a; for (a=1; a<=lastRow; a++) { var def = document.getElementById('sln'+ a); var ghi = document.getElementById('Mdesc'+ a); var jkl = document.getElementById('Mqty'+ a); var jkl1 = document.getElementById('Mqty'+ a).value; var abc = document.getElementById('Mbill'+ a); var gpexpdt2 = document.getElementById('tblMed').value; var str11 = document.getElementById("sdate").value; var str12 = document.getElementById("edate").value; var tranday = jkl1.substring(0,2); var tranmon = jkl1.substring(3,5); var tranyear = jkl1.substring(6,10); var trandate = new Date(tranyear,tranmon,tranday); var tranday2 = str11.substring(0,2); var tranmon2 = str11.substring(3,5); var tranyear2 = str11.substring(6,10); var trandate2 = new Date(tranyear2,tranmon2,tranday2); var tranday3 = str12.substring(0,2); var tranmon3 = str12.substring(3,5); var tranyear3 = str12.substring(6,10); if ((document.getElementById("AC").value == "")) { alert ( "Please enter Amount Claimed." ); document.form5.AC.focus(); return false; } else if((document.getElementById("Amb").value == "")) { alert ( "Please enter Relationship" ); document.form5.Amb.focus(); return false; } if ( document.form5.Treat.selectedIndex == "") { alert ( "Please select Treatment Type" ); document.form5.Treat.focus(); return false; } else if((document.getElementById("C10").value == "")) { alert ( "Please enter Total " ); document.form5.C10.focus(); return false; } else if((document.getElementById("C11").value == "")) { alert ( "Please enter Place " ); document.form5.C11.focus(); return false; } else if((document.getElementById("start").value == "")) { alert ( "Please enter from date" ); document.form5.start.focus(); return false; } else if((document.getElementById("edate").value == "")) { alert ( "Please enter to date" ); document.form5.edate.focus(); return false; } if (ghi.value.length == "") { alert('Please enter Bill No'); ghi.focus(); return false; } if (jkl.value.length == "") { alert('Please enter Date'); jkl.focus(); return false; } var trandate3 = new Date(tranyear3,tranmon3,tranday3); if (tranmon > 12|| tranmon < 1) { alert('Invalid Month In Date Field .Enter as dd-mm-yy'); jkl.focus(); return false; } if (tranday > 31|| tranday < 1) { alert('Invalid Date In Date Field Enter as dd-mm-yy'); jkl.focus(); return false; } if(trandate2.getTime() > trandate.getTime()) { alert("Bill date should be less than From date"); jkl.focus(); return false; } if(trandate3.getTime() < trandate.getTime()) { alert("Bill date should not be greater than End date"); jkl.focus(); return false; } if (abc.value.length == "") { alert('Please enter Amount'); abc.focus(); return false; } var str3 = document.getElementById("AC").value; var str4 = document.getElementById("Amb").value; if(parseInt(str3) > parseInt(str4)) { alert('Amount Claimed must be less than Amount Balance'); document.form5.AC.focus(); return false; } var alertsay = ""; if (form5.Treat.value > 4) { alert("Sorry You Can Not This Employee Data In Database.........."); form5.Treat.focus(); return (false); } var checkOK = "0123456789"; var checkStr = abc.value; var allValid = true; var allNum = ""; for (e = 0; e < checkStr.length; e++) { ch = checkStr.charAt(e); for (f = 0; f < checkOK.length; f++) if (ch == checkOK.charAt(f)) break; if (f == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { alert("Invalid Data Please enter only digits'"); abc.focus(); return (false); } } return true; } var count =0; function Check() { if (!validate()) return true; addRow() } function removeRow1() { var tbl = document.getElementById('tblMed'); var lastRow = tbl.rows.length; if (lastRow > 1) tbl.deleteRow(lastRow - 1); } function deleteRow(node) { if (rowNum > 1) { var td = node.parentNode; while (td.tblMed.toLowerCase() != "tr") td = td.parentNode; td.parentNode.removeChild(td); rowNum = rowNum - 1; document.form1.count.value = rowNum; } else { alert ("You cannot delete the last remaining row"); } } </script> <b><font color="#153E7E"border="1">Bill Details</b></legend><br> <table id="tblMed" width="75%"> <tr> <th>Sl.No.</th> <th align="left">Bill No</th> <th align="left" onClick="cal1xx.select(document.forms[0].edate,'anchor1xx','dd-MM-yy'); return false;" NAME="anchor1xx" ID="anchor1xx" onFocus="self.status='Select Treatment Start Date';return true; " onBlur="self.status='';return true;">Bill Date(DD-MON-YY)</th> <th>Bill Amount( <span class="WebRupee">Rs.</span> )</th> </tr> </table> <tr><br/>     <input name="button" type="button" value="Add Bill" onClick="Check()"/> ................................................................................................ i want popup calender in 3rd row of the table please help and if any one got solution then please please mail it to my gmail id : rajboy13@gmail.com Hi, I'm kinda hoping this is possible but haven't found any reference to it... I have a parent page that opens a popup on click that launches a sidebar navigation on the right of the screen and resizes the parent page. What I am wanting to do is create a second popup (approx 250px high) that opens below the navigation (which is only around 600px high) but I have noticed that even when you have no status bar in the popup windows, they can still end up overlapping because of additional tools or plugins that the viewer has in their browser. Is there any way to get the popups to butt up against each other instead of overlapping? More like a relative popup? Any assistance would be appreciated. :-) Code: <select class="drop" name="pet Display" id="drop" onChange="if(this.options[this.selectedIndex].value=='a') {document.getElementById('myFieldSet').style.visibility='visible'} else{document.getElementById('myFieldSet').style.visibility='hidden'}if(this.options[this.selectedIndex].value=='b') {document.getElementById('myFieldSet1').style.visibility='visible'} else{document.getElementById('myFieldSet1').style.visibility='hidden'}if(this.options[this.selectedIndex].value=='c') {document.getElementById('myFieldSet2').style.visibility='visible'} else{document.getElementById('myFieldSet2').style.visibility='hidden'}"> i need to fix this function or a different (external is better )with the same results thanxz Hello, I'm working on my little grabber and now I want to try something in javascript without success, so here my javascript code: PHP Code: //begin ajax grabber function validateGrabber(b_on_submit){ if(document.grabber.keywords.value == '' || document.grabber.keywords.value == 'search'){ alert('You did not enter a search term. Please try again.'); if(b_on_submit == 'true') return false; } else{ document.grabber.btn.submit(); } } function grabber(inputGrabber) { if(inputGrabber.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else if(inputGrabber.length > 2) { $.post(MELODYURL2+'/ajax_grabber.php', {queryString: ""+inputGrabber+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } // end ajax grabber and that's my template code: PHP Code: <form action="{$smarty.const._URL}/search.php" method="get" id="search" name="grabber" onsubmit="return validateGrabber('true');"> <input name="keywords" type="text" value="" class="search_keywords" id="inputGrabber" {if $smarty.const._SEARCHSUGGEST == 1}onkeyup="grabber(this.value);" onblur="fill();" autocomplete="off"{/if} /> <input name="btn" value="{$lang.submit_search}" type="submit" class="search_bttn" /> <div class="suggestionsBox" id="suggestions" style="display: none;"> <div class="suggestionList" id="autoSuggestionsList"> </div> </div> </form> the first function doesn't show the alert and the second doesn't work at all... Hi, In ASP.NET intranet web page have user input. Have 5 check boxes with two attending text boxes for each. The default value for the text boxes is zero and the text boxes are disabled for input. When the user checks a check box the two corresponding text boxes become enabled for input. Have two command buttons - Submit for database posting and Cancel. I set the Cancel button with a js window.confirm, uncheck the check boxes, and reset any input values in the text boxes back to zero. When I tested the code the checked check boxes were unchecked and the first text box holding user input was reset to zero value. However, the other text boxes containing user input values were not reset to zero. I altered the sequence of the code - for example - list the check box then its text boxes and so on. I tried listing the text boxes first then the check boxes. These did not resolve the problem - I was thinking linear execution of the code. Any suggestions to rememdy this? This is the js function: function Empty() { var res=window.confirm("Please confirm cancellation-your input will be cleared"); if(res==true) { document.getElementById("chkDVTT").value=""; document.getElementById("chkLM").value=""; document.getElementById("chkVMB").value=""; document.getElementById("chkVEB").value=""; document.getElementById("chkVUB").value=""; document.getElementById("txtDVTTRegHrs").value="0"; document.getElementById("txtDVTTOTHrs").value="0"; document.getElementById("txtBRLMRegHrs").value="0"; document.getElementById("txtBrLMOTHrs").value="0"; document.getElementById("txtVMBRegHrs").value="0"; document.getElementById("txtVMBOTHrs").value="0"; document.getElementById("txtVEBRegHrs").value="0"; document.getElementById("txtVEBOTHrs").value="0"; document.getElementById("txtVUBRegHrs").value="0"; document.getElementById("txtVUBOTHrs").value="0"; } } Thanks, John Hi. Firstly, i apologise for this being a google maps related question but the problem is a regular javascript question i believe, and it's really frustrating me. As i'm sure you're aware that with the maps you can click on a red 'marker' and make an info box pop up. I'm trying to do this with a text link outside of the map. My problem is calling that script via the text link. i really can't see what i'm doing wrong; my html link Code: <a href="javascript;" onmouseover="marker.openInfoWindowHtml();">test</a> and the javascript from the map Code: GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(); }); I'm sure it's something simple but i've been trying variations for hours and I can't get my head around it. Anyone with any ideas would be an absolute star. Cheers, Pat. I guess it is because it is 2am and had a few beers but i cannot get this to work and i know its pretty simple to do - see the code below: Code: {if ""|fn_needs_image_verification == true} {assign var="is" value="Image_verification"|fn_get_settings} <p{if $align} class="{$align}"{/if}>{$lang.image_verification_body}</p> {assign var="id_uniqid" value=$id|uniqid} {literal} <script language="javascript" type="text/javascript"> function reloadCaptcha() { captcha = document.getElementById("captureURLID").src; return captcha += 'reload'; } </script> {/literal} {if $sidebox} <p><img id="verification_image_{$id}" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" /></p> {/if} <p><input class="captcha-input-text valign" type="text" name="verification_answer" value= "" autocomplete="off" /> {if !$sidebox} <img id="verification_image_{$id} captureURLID" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" /> {/if} <img src="{$images_dir}/icons/icon_reload.png" height="25" width="25" alt="Reload Captcha Image" onclick="reloadCaptcha();" class="valign image-captcha" /></p> {/if} now the following works totally fine, when you click the captcha code changes..... "onclick="this.src += 'reload'" you will notice i have added a custom reload button image below this with a onclick calling a custom function "reloadCaptcha(); which i want to reload the captcha image above it - however it is not working, i have done the function so it grabs the src from the element ID, i have added 2 ID's to the IMG but cannot remember if you can have multiple IDs or not which if not could be causing the problem but not 100% sure how to include the smarty code for the generated ID on that image. Any ideas on the code above from having a quick glimps? as the code stands i get the error: Error: captureURL is null Many Thanks |