JavaScript - Errors In Popup For Javascript
I have a loop that originally printed out a day, in a table, that linked to a new page.
Code: out.println("<th height=100><a href=eventPage.jsp?month="+(n+1)+"&day="+d+">" + d + "</a>"); This works fine but now I want to instead have it be a link a page thats a pop up. The code I have now is as follows Code: out.println("<th height=100><a href="eventPage.jsp?month="+(n+1)+"&day="+d"" onclick="popUp(this.href);return false"> + d + "</a>">); and Code: <script type="text/javascript"> function popUp(URL) { <!-- window.open(URL,'width=300,height=300'); //--> } </script> I can not seem to find where I am going wrong. Any help would be appreciated. Similar TutorialsThe validator showed up these errors on my site. They are from a script, but I know very limited javascript to correct it, to me it seems to be OK. 1. Line 15, Column 23: character "<" is the first character of a delimiter but occurred as data for (var i = 0; i < d.length; ++i) { This message may appear in several cases: * You tried to include the "<" character in your page: you should escape it as "<" * You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe. * Another possibility is that you forgot to close quotes in a previous tag. 2. Error Line 15, Column 23: StartTag: invalid element name for (var i = 0; i < d.length; ++i) { Code: <script type="text/javascript"> window.onload = function() { if (!NiftyCheck()) { return; } Rounded("div#nifty", "#666", "#FFF", 30, 30); } function adjustRadius() { d = getElementsBySelector("div.rounded"); for (var i = 0; i < d.length; ++i) { d[i].parentNode.removeChild(d[i]); } var x = document.getElementById("radiusx").value; var y = document.getElementById("radiusy").value; Rounded("div#nifty", "#666", "#FFF", x, y); return false; } </script> Does anyone know why these errors are coming up on the WC3? here is the link where the problem persist http://www.ornusweb.com/what_we_done.html I have mixed 2 scripts the light box script(lightbox.js) and scroller script(scriptaculous.js) the page only works with ie and in other browsers it opens as an image(light box wont work) the errors say 1st error> uncaught script.aculo.us requires the prototype javaScript frame work >1.4.0 scriptaculous.load (anonymous function) 2 error > uncaught typeErrorbject function object(){[native code]} has no method 'extends' (anonymous function) can some one help me solve these problem's Ok, I'm not a javascript expert, but I'm using a Drupal module called Calendar which uses some javascript to popup links in a DIV instead of going to a new page. This appears to work by adding class="popup" to links on the calendar. I want to use the same functionality to link to calendar events from other areas on the site, not just on the calendar. It looks like the javascript file is loaded on every page of the site, but adding class="popup" only results in an empty DIV with a close button, without actually loading the content. Can anyone please help me solve this? A link to what I'm working on is he http://67.220.206.170/~jazzbone/?q=home. The upcoming events section is a block from the Calendar view (created by the Calendar module), however it does not do popups by default like the calendar page, so I've tried adding class="popup" to these links to make it work. You can see in the main body of the page is a test link with class="popup" as a test as well. I want them to behave like the popups on the event calendar page. I think this is the javascript file in question: http://67.220.206.170/~jazzbone/site...r/jcalendar.js I know this is a lot, and I'm a newbie here, but I appreciate any help, thanks. Hello, I am having trouble with a javascript length converter that I got from http://www.javascriptkit.com/script/...onverter.shtml It is working fine in dreamweaver, but when it goes live on my site, the calculations do nothing. I can see everything in the drop down menus, but when i click the "to" button, nothing happens. I got the following errors from chrome when activating any of the calculation functions. I'm wondering if anyone here can help me decipher these 1. Uncaught TypeError: Cannot read property 'from_unit' of undefined 1. convert_unitDefault.aspx:459 2. (anonymous function)Default.aspx:482 3. onchangeDefault.aspx:483 1. Default.aspx:459Uncaught TypeError: Cannot read property 'from_unit' of undefined 1. convert_unitDefault.aspx:459 2. (anonymous function)Default.aspx:496 3. onchangeDefault.aspx:497 1. Default.aspx:459Uncaught TypeError: Cannot read property 'from_unit' of undefined 1. convert_unitDefault.aspx:459 2. (anonymous function)Default.aspx:516 3. onclickDefault.aspx:517 Hi, I have a small script that opens a small popup in which to populate a form. What I want to do is include a variable so that a particular PHP page opens. I include where I am at present: HTML page calling JS popup: <input type="text" name="DOCUMENTS" id="DOCUMENTS" onclick="makeSelection(this.form, 'DOCUMENTS');"> JS Code: targetElement = null; function makeSelection(myform, id) { if(!myform || !id) return; targetElement = myform.elements[id]; var handle = window.open("../file_upload.php?dir=CODE", "mywindow","menubar=0,resizable=0,width=400,height=250"); } What I want to be able to do is get it so that the bit of JS that has 'dir=CODE' has a variable called from the HTML page. Is this possible, and if so, could anyone please help me out? Regards, Neil folks., i need to popup image on image hover?the image should be placed just above mouse pointer? i tried to implement event.x,event.y.. but it is not positoning well in all browsers..?is css need to be used here or please give me javascript code... this is the code function Large(obj,id,e) { // this is div tag,inside div i am placing imagebutton.. var imgbox=document.getElementById("imgbox"); var imgbtn=document.getElementById('<%=ImageButton3.ClientID%>'); imgbox.style.visibility='visible'; imgbtn.src=obj; imgbox.style.left=event.x; imgbox.style.top= event.y; } thank you Do you log JavaScript errors on your live website? The actual errors that users experience? If you do, what tool do you use? And how is it woring out? If you don''t why not? I would like to remove some hosting imposed google ads on my phpbb board. Currently I accomplish this by deleting via javascript all the banners divs when the page is loaded. But unfortunately in that way advertisements are quickly displayed before disappearing. Now I am thinking about a different (neater) approach to my problem: maybe I might write some javascript code which interferes with the one injected by google thus generating the inability to show those annoying divs... Any idea? I'm working with greasymonkey scripts. Firefox JS console would always display GM script errors, but all of the sudden it stopped doing that. Script just won't load and no errors are displayed. I didn't touch any settings, yesterday they were showing fine, today none are displayed. Would appreciate any help.
hello everybody, here I'm asking for help again. sorry for that in advance. anyhow, I have the following code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link type="text/css" media="screen" rel="stylesheet" href="colorbox.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="../colorbox/jquery.colorbox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".example7").colorbox({width:"300px", height:"500px", iframe:true, open: true}); }); </script> </head> <body onload="example7();"> <a class='example7' href="tofes.html"></a> teststestestest </body> </html> I want the lightbox window open only once a day for every unique visitor on my website. I understand I should use some sort of cookie implented, but I dont really understand how to. Thanks in advance, daniel. Hello Everyone, First of all i'd like to thank you for this wonderful forum, you people have helped me.. Now, i'm back here because i have this problem...i have a website built with drupal, www.plus-demo.info/drupal If you see the second menu, when you hover there is a submenu which pops out...what i want for this popup menu is to display in a fixed position...it shouldn't get out of the borders of the website...there is the code which has to do with it... Please help me... function muchomenu_display() { if (hoverParent) { hoverParent.addClass('hovering'); hoverBin = hoverParent.find('.muchomenu-bin'); /* display position */ //hoverBin.css('top', 'auto'); /* display position end */ animateIn(hoverBin); } } function muchomenu_close(){ if (hoverParent) { oldParentIdx = $('.muchomenu-parent').index(hoverParent); } for ( var i=0 ; i < megaParents.length ; i++ ) { megaParents.eq(i).removeClass('hovering'); } animateOut(hoverBin); } function checkHorizontalPosition(item) { var parentOffset = item.parents('.muchomenu-parent').offset(); var screenWidth = $(document).width(); var itemPosition = item.position(); var padding = 30; var p = item.width() + itemPosition.left + parentOffset.left + padding; if (p > screenWidth) { var newOffset = screenWidth - p; item.css('left', newOffset + 'px'); } } Hey Guys, I'm trying to make a popup. Let me rephrase, not the type of popup that we all have cursed upon! But the same concept. I have a "control panel" type web application that i have developed. It is all completely dynamic. Each application has its own index.php file. My problem is, one of my applications i need has to open in a new window since its an external site. My problem is the way i have it setup dynamically in php i MUST have that inital index.php file. So what i have tried is to put in that index file just some javascript that opens a new window. Of course both IE and FF's popup blocker kick in. I need to find away around this. Does anyone have any ideas? So far i'd tried a window.open.... also tried creating a link with a target and id and then using click(); to deploy it. And i even tried creating a fake form with a target and an id and submiting it with javascript. Everything gets blocked. Thanks in advance, Jamie Hello! I have a script that loads a popup window on any page of a website, in order to temporarily cover the page's content. This popup window is supposed to load on top of page's content, acting as a sort of page blocker. So the visitor can't see what's on the page until he clicks the popup. The problem i'm having right now is when i put this script on a page that has iframe content. The iframe loads on top of this popup and not underneath as it's supposed to be. Do you guys have any advise on what should i do to make this work properly when using iframes on a page? Here is the script: Code: var blocker_originalHtmlOverflow; var blocker_originalBodyOverflow; function blocker_addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } blocker_addLoadEvent(blocker_init); function blocker_init() { if(blocker_getCookie('content_unlocked')=='1') return; blocker_originalHtmlOverflow = document.getElementsByTagName('body')[0].style.overflow; blocker_originalBodyOverflow = document.getElementsByTagName('html')[0].style.overflow; document.getElementsByTagName('body')[0].style.overflow = 'hidden'; document.getElementsByTagName('html')[0].style.overflow = 'hidden'; function pageScroll() { window.scroll(0,0); // scroll to 0 if(blocker_getCookie('content_unlocked')!='1'){ scrolldelay = setTimeout('pageScroll()',100); // scrolls every 1 second } } pageScroll(); var haze = document.createElement('div'); haze.id = 'blocker_haze'; haze.style.filter = 'alpha(opacity=50)'; haze.style.opacity = .5; haze.style.height = '2000'; haze.style.width = '2000%'; haze.style.backgroundColor = '#000'; haze.style.position = 'absolute'; haze.style.top = '0px'; haze.style.left = '0px'; haze.style.zIndex = 1000000; var centerPane = document.createElement('centerPane'); centerPane.id = 'blocker_centerPane'; centerPane.style.width = '500px'; centerPane.style.height = '361px'; centerPane.style.border = '5px solid #CCC'; centerPane.style.position = 'absolute'; centerPane.style.left = '50%'; centerPane.style.marginLeft = '-250px'; centerPane.style.top= '100px'; centerPane.style.backgroundColor = '#FFF'; centerPane.style.zIndex = 1000001; centerPane.style.backgroundImage = 'url(http://www.fasgasfga.com/sfasdfasdf.jpg)'; centerPane.style.backgroundRepeat = 'no-repeat'; centerPane.style.backgroundPosition = '20px 10px'; centerPane.style.padding = '20px'; var h1 = document.createElement('h1'); h1.style.color = '#000'; h1.style.textAlign = 'center'; h1.style.fontSize = '36px'; h1.style.margin = '0 0 10px 0'; h1.style.padding = '8px 0 0 15px'; h1.style.fontFamily = 'arial'; h1.style.lineHeight = '36px'; h1.innerHTML = blocker_headline; centerPane.appendChild(h1); var p1 = document.createElement('p'); p1.innerHTML = blocker_instructionalText; p1.style.textAlign = 'center'; p1.style.padding = '20px 0 20px 0'; p1.style.margin = '0'; p1.style.fontSize = '18px'; p1.style.lineHeight = '18px'; p1.style.color = '#000'; p1.style.fontFamily = 'arial'; centerPane.appendChild(p1); var ul = document.createElement('ul'); ul.style.textAlign = 'center'; ul.style.margin = '0 0 10px 0'; ul.style.padding = '0'; ul.style.listStyleType = 'none'; for(var i = 0;i<blocker_surveryLinks.length;i++){ var li = document.createElement('li'); var a = document.createElement('a'); a.style.display = 'block'; a.style.fontSize = '17px'; a.style.lineHeight = '380px'; a.style.color = 'Black'; a.style.fontFamily = 'arial'; a.style.textDecoration = 'underline'; a.target = '_blank'; a.href = blocker_surveryLinks[i].url; a.innerHTML = blocker_surveryLinks[i].text; a.onclick = function(){ window.setTimeout(unblockContent, 55000); } li.appendChild(a) ul.appendChild(li); } centerPane.appendChild(ul); var p2 = document.createElement('p'); p2.style.textAlign = 'center'; p2.innerHTML = blocker_footerText; p2.style.padding = '20px 0 0 0'; p2.style.margin = '0'; p2.style.color = '#F50E0E'; p2.style.fontFamily = 'arial'; p2.style.fontSize = '15px'; p2.style.lineHeight = '15px'; centerPane.appendChild(p2); document.getElementsByTagName('body')[0].appendChild(haze); document.getElementsByTagName('body')[0].appendChild(centerPane); } function unblockContent(){ document.getElementsByTagName('body')[0].style.overflow = blocker_originalBodyOverflow; document.getElementsByTagName('html')[0].style.overflow = blocker_originalHtmlOverflow; document.getElementById('blocker_haze').style.display = 'none'; document.getElementById('blocker_centerPane').style.display = 'none'; //blocker_setCookie("content_unlocked", 1, 365, '/', ''); Set_Cookie( 'content_unlocked', 1 , 365, '/', '', '' ); } function Set_Cookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); /* if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, delete * 24, for minutes, delete * 60 * 24 */ if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function blocker_setCookie(c_name,value,expiredays){ var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function blocker_getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } 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'm receiving the following errors: line 6 Expected an element name[xml] line 17 the input ended before all started tags were ended. last tag started was 'script'[xml] Code: <script type="text/javascript"> var camp = xfa.resolveNodes("camp[*]"); var total = 0; for (var i=0; i <= camp.length-1; i++) { if (camp.item(i).isNull) { total = total; } else { total = total + 30; } } this.rawValue = total; </script> I've got next to zero experience with javascript so not even sure what I should be looking to fix...any help is appreciated, if I need to answer something I missed, just let me know. I have created a small file where I check if the passwords entered in the code match or not, if they do not match, the button that links to the next webpage should not work(allow them to go to the next wepage). ive tried various websites to help me try and solve this but I just dodont understand what they are doing. I'm very new to programming btw here is some example code: Code: !doctypeHTML <html> <script> //lets just pretend that ive already done all the .getelement by id stuff to get the code things //suppose the person did not write anything in the form, an error will get pushed(alerted basically) if(!form['password'].value) error.push('Missing Password'); <form> <label>Password<br><input type="password" name="password"></label> <label>Confirm Password<br><input type="password" name="confirm"</label> </form> </html> now how would I make the submit button not submit if there are errors? please be as simple as possible, I am new to this! Validator (My CSE HTML Validator v9.0 ) reports javascript errors but program runs. There seems to be a problem with commands used twice and a missing semi-colon. Also there are problems with Firefox. Unable to reselect another image. OK with IE8. I would appreciate it if someone with better eyesight than me could give the jscript a once over for me. Thanks oin advance. Frank Culprit is here. EDITED. For some reason i cant get this bit of code to work. You can ignore the php and html if its getting in your way. Thanks: Code: <div id="pl"> <? if($edit == true){ ?> <script type="text/javascript"> $("#add_playlist_form").css({display:"none"}); $("#add_playlist").click(function(){ alert($("#add_playlist").html()); if($("#add_playlist").html() == "Add a Playlist >>"){ $("#add_playlist").html("Hide <<"); $("#add_playlist_form").css({display:"block"}); } else{ $("#add_playlist").html("Add a Playlist >>"); $("#add_playlist_form").css({display:"none"}); } }); </script> <a href="#" id="add_playlist">Add a Playlist >></a> <form id="add_playlist_form" method="POST" action=" "> <input type="text" name="pl_name" class="add_playlist"/> <textarea name="pl_dsec" maxlength="200"></textarea> <input type="submit" name="submit_playlist" value="Add Playlist" class="submit_playlist"/> </form> <? } ?> <ul class="vList"> I currently have a popup window that works fine but while that window is up on top and I click on another link that opens another window the popup goes behind that window. How do I code to get the popup window to always stay on top no matter what window I open up with the code I have below: Code: <script language="javascript" type="text/javascript"> function test() { setTimeout("self.focus()",3000) } function open_new_window() { //new_window = open("","hoverwindow","width=300,height=200,left=10,top=10"); new_window = window.showModelessDialog("","hoverwindow","width=300,height=200,left=10,top=10"); new_window.focus(); // open new document new_window.document.open(); // Text of the new document // Replace your " with ' or \" or your document.write statements will fail new_window.document.write("<html><title>JavaScript New Window</title>"); new_window.document.write("<body onBlur = "test();" bgcolor=\"#FFFFFF\">"); new_window.document.write ("Week 1 Question".bold()); new_window.document.write("<table><tr><td>Is there a role of process owner in your organization? If not, how will you overcome this challenge? Why do you need process owners as a Lean Six Sigma Green Belt Project Leader?</td></tr></table>"); new_window.document.write("<br />"); new_window.document.write("</body></html>"); // close the document new_window.document.close(); } // This is the function that will close the // new window when the mouse is moved off the link function close_window() { new_window.close(); } </script> |