JavaScript - What Would You Call This Script?
http://www.zooprinting.com/welcome
the section with 5 things that rotate starts with "free design online" i need to make an element like that on my site, and i'm pretty handy at googling until i find the script i'm looking for and making it work, but i can't figure out what in the world to call that. it's commonly used but i just can't seem to get my search terms right. anyone know where i can find said script? Similar Tutorials1)I want to make a http request to a url lets say http://test1.com/info this will give me xml 2)I want to convert this xml from 1 to json lets say json 1 3)Now I make a rest request to url lets say http://test2.com/myweb this returns a json lets say json 2 json 1 [ { "id": "123", "testname": "test123", "name": "John Doe", "active": true, "type": "test6" } { "id": "456", "testname": "test564", "name": "Ship Therasus", "active": true, "type": "test7" } .... some 100 entries ] and json 2 some like below [ { "id": "123", "country": "USA", "state": "KA", "age": 24, "group": "g1" } { "id": "456", "country": "UK", "state": "MA", "age": 28, "group": "G2" } ...... 100 entries ] Now Id is the constant thing between json1 and json2 I want to make a resultant json something like below lets call json3.I want to match the id and get country and state from json2 and append to json1 [ { "id": "123", "testname": "test123", "name": "John Doe", "active": true, "type": "test6", "country":"USA", "state":"KA" } { "id": "456", "testname": "test564", "name": "Ship Therasus", "active": true, "type": "test7", "country":"UK", "state":"MA" } ] Now wat i tried for 1 and 3 but for 2 dont know wat to do and to compare and combine I am not sure wat to do If any help will be greatful function fun() { var data="hello"; $.post('http://localhost/ws/service.asmx/HelloWord',{},function(response) { data = response; }).error(function(){ alert("Sorry could not proceed"); }); return data; } "<scr'+'ipt type="text/javascript" src="js/val_feedback_Email.js<\/scr'+'ipt>" How should I call the js validation script for a feedback form that was document.written in a pop up? I have a page which contains a button. Onclick it produces a pop up window that contains a small feedback form produced by document.write. This much works. NOW I need to call the js validate script but nothing seems to work I tried this is the head of the page <script type="text/javascript" src="js/val_feedback_Email.js"> I tried this is the head of the doumnet.write part "<scr'+'ipt type="text/javascript" src="js/val_feedback_Email.js<\/scr'+'ipt>" How do I call the js script to validate the form in the pop up? Where if anywhere should it go? I'm stumped Any and all ideas welcomed LT THis is the start of my script Code: <script type="text/javascript"> var newWindow; function subWrite() { newWindow = window.open("","","status,height=500,width=700") //bring subwindow to front newWindow.focus(); //assemble content for new window var newContent = '<html><head><title>ACES UK. Send us your Email</title>'; newContent += '</head><body>'; newContent += '<form action="feedback.php" method="post" name="feedback_1" id="feedback_1" onsubmit="return validate(this.form)"'; What im trying to do is to dynamically call an external javascript file. The script once called will provide variables for another function. I have tried using this function PHP Code: function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } loadjscssfile("myscript.js", "js") //dynamically load and add this .js file loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a J which works.The problem is that variables can not be passed through from the external script to the parent script. I understand why this is, but i am wondering if there are other ways to load (or refresh) an external script? For the sample code: Code: <form name=form> <ul> <li><input type="text" onkeyUp="calc1();" name=x ></li> <li><input type="text" onkeyUp="calc2();" name=y ></li> </ul> </form> <script> function calc1() { document.form.y.value = (10 * document.form.x.value).toPrecision(5); } function calc2() { document.form.x.value = (0.1 * document.form.y.value).toPrecision(5); } </script> How can I use a checkbox to : (1) Upon check, change the current values to toExponential(5) format (2) Use a different script and/or function that would then calculate with toExponential(5) [as opposed to the hard coded toPrecision(5) in the current functions. (3) Upon unchecking, the result should should go back to Precision and change the function and/or script back to the original. Hi, I am hoping I just need to be pointed in the right direction with this. I have Page1. When Page1 body onloads it uses Ajax to call PartA Within PartA I have a message board so members can write messages which will be sent to my database in PartA[1] and immediately posted for view on to PartA[2]. As I want to have my request to the server updating regularly I want to have PartA[2] on a timed loop to refresh - I do not need the content of PartA[1] to refresh. So the order of events would look like this: Page1 | onload call | v PartA / \ V V PartA[1] PartA[2] (loads once) (constantly refreshes) What I am not sure about is that I have <body> and <head> attributes in Page1 only. I have already used my body onload to call PartA (and can't use it to call PartA[2] before PartA has loaded anyway). I do not want the user to have to click a button or do anything to call up PartA[2]. So my question is how would I get PartA[2] to automatically load within PartA? I hope I have made this clear, but if I haven't let me know and I will try again. Hello all, I am a newbie to api and I want to bring job website into my site using that job website's api. They provide calling url to the xml api to get response. But I dont to know how to get response through javascript. Can you please help me to call that api through javascript or java? Hope that it is simple to you. Thanks in advance... Hello, if in a webpage is included a javascript file (for example code.js) can I from my browser call a function contained in code.js and will it works correctly? I'm not meaning that the function is called in the page with or without a link to click, but it is only in code.js! Thank you! hi i'm trying to call a web service from java script code stored NOT in Html but in an extenarl file .js. My code is this: service.useService("http://localhost:10000/WebS_cod_01/WebS_codEurService.asmx?wsdl", "WebS"); Photo = service.WebS.callService("webS_codEurProcessWS" , photoID); checking with Firebug i find this message: "service is not defined" where i'm wrong ? thanks in advance I'm trying to implement this 'ajax' script, however i'm getting the following error: function expected line 25. And I'm not the only person who is getting this error message :S How can the code be altered so it will work? Also the script isn't executed when I change onclick in onload :S How come and how can I change it so that it will be executed on launch? http://chriscook.me/web-development/...icking-a-link/ Right for day's i've searching for a jQuery/js/ajax script that opens like facebooks box where you can delete things update posts and so on... But i don't want that facebox thing i want a tut where i can buy things that will insert into the database and delete things and sooo on... I've made the box i just want the script for it.... I'm not good with js/jQuery/ajax.... Thanks. My problem is that I am trying to call an function within an SWF. Now, I already know how to setup my SWF and that isn't the problem. The problem is that when I try to call the function using Javascript, I am told that the function doesn't exist. I'll show you the code right here. Code: function AudioPlayerEmbed( e ) { if ( e.success ) { e.ref.LoadAudio( 'http://therevolve.com/upload/userfiles/Music/Alec_Smith1.mp3' ); } } swfobject.embedSWF("player/MP3Player.swf", "flash", "300", "90", "9.0.0", "player/expressInstall.swf", null, null, null, AudioPlayerEmbed ); HOWEVER, when I put some alert before the call, it happens to work. What is going on? Code: function AudioPlayerEmbed( e ) { alert("A"); if ( e.success ) { e.ref.LoadAudio( 'http://therevolve.com/upload/userfiles/Music/Alec_Smith1.mp3' ); } } swfobject.embedSWF("player/MP3Player.swf", "flash", "300", "90", "9.0.0", "player/expressInstall.swf", null, null, null, AudioPlayerEmbed ); Here is a live example. Any help would be appreciated. If you need more information, I can provide it. Hello. Started my massive JavaScript career just yesterday and the forums I frequent still lack a proper BB-code hide-tag, so I figured I'd try make it in JavaScript, since HTML is allowed on there. This is what I did: Code: <script type="text/javascript"> function show() { document.getElementById('silHideTextTag').innerHTML='Hidden text!!'; document.getElementById('silHideTextBtn').value='Hide'; document.getElementById('silHideTextBtn').onclick='hide()'; } function hide() { document.getElementById('silHideTextTag').innerHTML=' '; document.getElementById('silHideTextBtn').value='Show'; document.getElementById('silHideTextBtn').onclick='show()'; } </script> <input type='button' id='silHideTextBtn' onclick='show()' value='Show'/> <div id='silHideTextTag'> </div> The button labelled "Show" appears fine, when I click it it becomes "Hide" and the text "Hidden text!!" is shown. However, when I click the button again, nothing happens at all. I don't quite understand where the problem is. Thanks in advance for any clues. Best regards, Zyl Hi Guys, I dont use JS much, I did take it in school years ago but cant remember much of it, what Im trying to do is quite simple, just a random quote gen but I want it to get the quots from a separate file as the quotes will appear on every page so I dont want to have to edit each page every time a new one needs to be added. I just found a simple quote generator online that I want to modify to call the array from a different file, the gen looks like this: var Quotation=new Array() // do not change this! Quotation[0] = "Time is of the essence! Comb your hair."; Quotation[1] = "Sanity is a golden apple with no shoelaces."; Quotation[2] = "Repent! The end is coming, $9.95 at Amazon."; Quotation[3] = "Honesty blurts where deception sneezes."; Quotation[4] = "Pastry satisfies where art is unavailable."; Quotation[5] = "Delete not, lest you, too, be deleted."; Quotation[6] = "O! Youth! What a pain in the backside."; Quotation[7] = "Wishes are like goldfish with propellors."; Quotation[8] = "Love the river's \"beauty\", but live on a hill."; Quotation[9] = "Invention is the mother of too many useless toys."; var Q = Quotation.length; var whichQuotation=Math.round(Math.random()*(Q-1)); function showQuotation(){document.write(Quotation[whichQuotation]);} showQuotation(); </script> If anyone could help me get that array into another file and call it from that script I would really appreciate it. Thanks guys! <frameset rows="30%,70%> <frame src="page1.html" name="name1" frameborder="0"></frame> <frame src="page2.html" name="name2" frameborder="0"></frame> </frameset> in above code I used page1.html & page2.html as frame. Both include same javascript file having two function name fun1() & fun2(). as both are separate frame both have there own copy function page1.html fun1() fun2() page2.html fun1() fun2() I call fun2() from page2.html and inside that function I want to call page1.html's fun1(). fun1() in page1.html and fun1() in page2.html both return different result because of there global variables. Is there any way to call fun1()-page1.html from the fun2()-page2.html? Hello, I am trying to use a for loop to call images of custom text. For example, I have images named uppera.png and lowera.png for a custom font. I need the image of the letter to show up as they type into a text area, but also have backspace work correctly to delete the last image added. Here is the code I have thus far: <script type="text/javascript"> function callimage() { var chars = document.getElementById('userinput').value.split(""); for (i=0; i < chars.length; i++) { if (chars[i] == "A") { var image = "uppera.png"; } if (chars[i] == "a") { var image = "lowera.png"; } ... if (chars[i] == "9") { var image = "9.png"; } document.getElementById('visual').innerHTML = document.getElementById('visual').innerHTML + '<img src="' + image + '"/>'; } } </script> <input type="text" maxlength="20" id="userinput" onkeyup="callimage()"/> <p id="visual"> </p> When I test this out it takes the previously entered text and adds it to the new text and combines them. For instance if you entered "a" it would show up as "a"; if you entered "a" again it would show up as "aaa" and then "aaaaaa" and so on. Also, it will add the existing characters again if any key is pressed, like just shift. I think I would need to write an else statement to fix that part, but I don't know what to put there, either. Any ideas on how I could fix this one? Thanks! When calling a javascript file I have written <script type = "javascript" src = "mycode_2010.js"> However, I would like to replace 2010 with a variable so that for example I can detect the year and load the appropriate code e.g. mycode_2011.js rather than writing a new hard coded html page. Is it possible please? How do I call this popup from a .js file?? Here is my popup code <script type="text/javascript" src="fad.js"></script> <link rel="stylesheet" type="text/css" href="fad.css" /> </head> <body> <div id="fa"> <div class="fa_close"><a href="#" onclick="hFa()"><img src="close1.jpg" /></a></div> <h1><i>THIS WEEK'S</i></h1> <img src="special.jpg" alt="special" /> </div> From html I would call it using: <script type="text/javascript">sFa();</script> How do I activate this popup from a .js file I am relatively new to JavaScript so am still learning. I have a page I would like to call a function when it loads but not sure how to do this. The function is http://tickettransaction.com/?bid=20...ults&venid=101 and should function similar to this page when loads http://paviliondallas.com/ I could get that with html but not sure how to auto load to render ths list from the provided plugin. Another example is http://www.justbuytickets.com/Venues...FcY32godDU-hzw Any help would be appreciated. Thanks in advance. How do I do a blocking call in javascript? In the code below the alert at the last line of this code snippet hits before the code in if block completes which returns some value, by calling chached.get method in different js file. var getCachedData = function(_key){ var retStr; if (_key != '' || _key != null) { cached.get(_key, function(data){ if(data){ alert('data = ' +data.value); return data.value; } else{ return undefine; } }); } alert('completed'); } Please help |