JavaScript - I Need Help With Calling Dynamic Urls From Scene7
I'm trying to learn how to use the url's scene7 gives me to have dynamic zoom images. The problem is I cant figure out how to load the url into a webpage instead of the browser. Here is an example image using the flyout zoom feature in scene 7. In the browser you can see the url is calling the image and the dynamic feature from scene7. How do i do this in a webpage using whatever code I need to. I've tried making it a link with an img src but that doesnt work. Im stuck and need help. Thanks for your advice. Oh, and if this is the wrong section to post in I apologize.
Similar TutorialsHi All, i know how to create a dynamic form or DIv ..but what i do not know is how to create a dynamic form/ or div into a previous dynamic one.. i need basically to see 5 dynamic forms / DIV in cascade where each one trigger the one coming after.. For what i need that : i have my user inserting information on the level 1. let say Copagny info 2- then he will be asked if he wants to add a sub level information ( subform) for that compagny or even many subforms at the same level .. and so on... 3- those sub level ( subforms ) can also call their respective subforms.. Any idea how to design this ? thanks Hello, How I open urls sequencially - one by time -, but automatically (each 5 seconds) from a list with dozens of URLs in the same iFRAME? I have what i think it is a simple question to answer. I have a button to open a new link in a iframe (in the same browser window). And what i need is that after i press the button, the link opened would come from a list of html sequencially. I dont want that the html opened would be from a random choice, but i want to be sequential. I hope that i'm being clear in my line of thought. Is this possible? cheers!!! Jan Lee Doing some forum searching, I found the following code: Code: <div id="someThing" style="display:block" >Put something here.</div> <script type="text/javascript"> var nowUrl = location.href; if (nowUrl != "http://jemmakidd.com/categories.php") { document.getElementById("someThing").style.display="none"; } </script> Apparently, this is for use of when you are modifying, for example, a PHP header or footer displayed on every page and you only want something to show up on particular pages. My issue is that I am trying to put something in the header of a Tumblr blog, and I only want it to show on the post pages. The Tumblr main page format is: http://*.tumblr.com/ The Tumblr post page format is: http://*.tumblr.com/post/* Is there any code I can use to do this? Hello, I'm a complete novice in anything javascript and I've bit off more than I can chew! This script Code: function fixmenu(whichmenu) { var menu = whichmenu.find("a"); for(x = 0; x < menu.length; x++) { var o = menu.get(x); if(o.href.indexOf(".php") < 0) { var i = o.href.lastIndexOf("/"); var nl = "http://domain.com/" + o.href.substring(i + 1); o.href = nl; } } } function flinks() { fixmenu(j$("#div1")); fixmenu(j$("span#div2")); fixmenu(j$("div.div3")); } if(location.href.indexOf("sub.") >= 0 || location.href.indexOf("SUB.") >= 0) { j$(document).ready(flinks); } is not something I wrote, but something I am to make work, and I don't even know where to begin. I'm working on building a website on a custom CMS (I have no control over) and it uses relative urls (no control over that). The problem is we're integrating it with another system on subdomain. Not too sure if that makes sense. Anyways... what this is suppose to accomplish is when the website is at sub.domain.com it rewrites the relative urls in the 3 div containers to absolute urls, but ignore the links going to sub.domain.com already. In the menu (#div1) there are relative links (/page) and then there are links going to sub.domain.com/page. When we go to sub.domain.com it should rewrite the relative links (/page) to domain.com/page, but ignore sub.domain.com/page (absolute link). instead it is rewriting the entirety. Any idea as to how to make this work? At least, I think it is. On my test site (http://goo.gl/P4SLu), you'll see that the URL first goes to "emineer.com/thesis/," but then quickly changes to "emineer.com/thesis/#page=tabsservices" which refers to a piece of .js I have lower on the page (the tabbed navigation). Is there a way for me to configure this js or CSS so that the URLs are unchanged? I know it's possible because my main site functions perfectly fine: (emineer.com). The code on my main site is just clunky so I decided to start from scratch. Any help here? I'd really like my URLs clean and free of any tags or anything like that. Thanks, Brandon I have made a script where you can add extra fields, and next to the row is a span that automatically displays the outcome from a calculation of three fields in that row. i.e. Q x (B - A) = total. Here is the bit that does the calculation: Code: function advCalc(selected) { var result = Number(document.formmain.elements["quantity"+selected].value) * (Number(document.formmain.elements["provideamount"+selected].value) - Number(document.formmain.elements["supplyamount"+selected].value)) ; result = result.toFixed(2) ; result = addCommas(result) ; document.getElementById("total"+selected).innerHTML = result ; } The bit that adds a new row of fields is: Code: function addPart(divName){ var newdiv = document.createElement('div') ; newdiv.setAttribute('id', 'partrow' + counter) ; newdiv.setAttribute('style', 'clear:both;') ; newdiv.innerHTML = "<div style='float:left;width:40px;text-align:center;margin:5px 5px 0px 0px;'>\r<input onkeyup=\"advCalc('" + counter + "')\" id=' quantity " + counter + "' type='text' value='1' size='1'/>\r</div>\r<div style='float:left;width:100px;text-align:left;margin:5px 0px 0px 0px;'>\r<input id='manufacturer" + counter + "'type='text' value='' size='9'/>\r</div>\r<div style='float:left;width:95px;text-align:left;margin:5px 5px 0px 0px;'>\r<input id='partnumber" + counter + "'type='text' value='' size='9'/>\r</div>\r<div style='float:left;width:80px;text-align:left;margin:5px 5px 0px 0px;'>\r<input id='supplier" + counter + "'type='text' value='' size='4'/>\r</div>\r<div style='float:left;width:100px;text-align:left;margin:5px 5px 0px 0px;'>\r<input id='type" + counter + "'type='text' value='' size='6'/>\r</div>\r<div style='float:left;width:85px;text-align:left;margin:5px 5px 0px 0px;'>\r<input id='deliverytime" + counter + "'type='text' value='' size='13'/>\r</div>\r<div style='float:left;width:40px;text-align:left;margin:5px 0px 0px 45px;'>\r<select id='supplyCurrency" + counter + "'>\r<option value='pound' selected='selected'>£</option><option value='dol'>$</option><option value='euro'>€</option></select>\r</div>\r<div style='float:left;width:15px;text-align:left;margin:5px 5px 0px 0px;'>\r<input onkeyup=\"advCalc(\'" + counter + "\')\" id=' supplyamount " + counter + "'type='text' value='' size='3'/>\r</div>\r<div style='float:left;width:40px;text-align:left;margin:5px 0px 0px 45px;'>\r<select name='provideCurrency" + counter + "'><option value='pound' selected='selected'>£</option><option value='dol'>$</option><option value='euro'>€</option></select>\r</div>\r<div style='float:left;width:15px;text-align:left;margin:5px 5px 0px 0px;'>\r<input onkeyup=\"advCalc(\'" + counter + "\') id=' provideamount " + counter + "' type='text' value='' size='3'/>\r</div>\r<div style='float:left;width:20px;text-align:left;margin:5px 0px 0px 45px;'>\r<strong>£</strong>\r</div>\r<div style='float:left;width:40px;text-align:left;margin:5px 5px 0px 0px;'><span id=' total " + counter + "'></span></div> \r" ; document.getElementById(divName).appendChild(newdiv) ; counter++ ; } The problem I am having is that it works fine for the first row which is hardcoded as e.g. id="provideamount0" etc. It isn't working for any other fields added but I can't see what is wrong I am trying to load some hundreds of urls from a local text file. I was able to load them into an array. I want to load them sequentially after certain time interval. The script works fine if I remove setinterval but without it only 1 url gets loaded. Is there any other way to load all urls automatically 1-by-1. Here is the code: <html> <head> </head> <script type="text/javascript"> var allText =[]; var allTextLines = []; var Lines = []; var txtFile = new XMLHttpRequest(); //var i=0; txtFile.open("GET", "URL.txt", true); allText = txtFile.responseText; txtFile.onreadystatechange = function f() { if (txtFile.readyState == 4) { allText = txtFile.responseText; allTextLines = allText.split(/\r\n|\n/);//the urls are separated by /n document.write(allText); var i=Math.floor(Math.random()*100); window.location=allTextLines[i]; setInterval(f(),5000);// trying to load after 5 sec. } else { //alert("Didn't work"); } } txtFile.send(null); // <body onLoad="setInterval('f()', 30000)"> /* function onLoad(URL){ if(onLoad.loaded) window.setTimeout(f,0); else if (window.addEventListener) window.addEventListener("load",f,false); else if (window.attachEvent) window.attachEvent("onload",f); } onLoad.loaded=false; onLoad(function() { onLoad.loaded=true; }); */ </script> </html> I want to type urls in a text field, submit such urls and extract pictures of these web pages. Does anyone know how I can do this using javascript? Thanks, Marcelo Brazil I got this code to WORK with Buttons... But, i can NOT get it to work with URLs/LINKs... dose anyone have any suggestions? The URL alternative LINKs are placed below the buttons... but like i have said, they don't work. Help Pleeeeese. Thanks. ****HEAD <script language="javascript" type="text/javascript"> function getCheckedValue() { document.getElementById("presentationsNavBars").style.display = 'block'; document.getElementById("proposalsNavBars").style.display = 'none'; document.getElementById("postingsNavBars").style.display = 'none'; document.getElementById("myaccountNavBars").style.display = 'none'; } function getCheckedValue2() { document.getElementById("presentationsNavBars").style.display = 'none'; document.getElementById("proposalsNavBars").style.display = 'block'; document.getElementById("postingsNavBars").style.display = 'none'; document.getElementById("myaccountNavBars").style.display = 'none'; } function getCheckedValue3() { document.getElementById("presentationsNavBars").style.display = 'none'; document.getElementById("proposalsNavBars").style.display = 'none'; document.getElementById("postingsNavBars").style.display = 'block'; document.getElementById("myaccountNavBars").style.display = 'none'; } function getCheckedValue4() { document.getElementById("presentationsNavBars").style.display = 'none'; document.getElementById("proposalsNavBars").style.display = 'none'; document.getElementById("postingsNavBars").style.display = 'none'; document.getElementById("myaccountNavBars").style.display = 'block'; } </script> ****** BODY <div class="student_text"> <asp:RadioButton ID="RadioButton1" GroupName="reg" Text="presentations" runat="server" OnClick="return getCheckedValue();" /> <br /> <%--OR how do i get it to work when using a URL as shown below for example--%> <a href="navPageTest2.aspx" runat="server" onclick="getClickedValue();">Presentations_link_ex</a><br /> </div> <br /><br /> <div class="student_text"> <asp:RadioButton ID="RadioButton2" GroupName="reg" Text="proposals" runat="server" onclick="return getCheckedValue2();" /> <br /> <%--OR how do i get it to work when using a URL as shown below for example--%> <a href="navPageTest2.aspx" onclick="getClickedValue2();">Proposals_link_ex</a><br /> </div> <br /><br /> <div class="student_text"> <asp:RadioButton ID="RadioButton3" GroupName="reg" Text="postings" runat="server" onclick="return getCheckedValue3();" /> <br /> <%--OR how do i get it to work when using a URL as shown below for example--%> <a href="navPageTest2.aspx" onclick="getClickedValue3();">Postings_link_ex</a><br /> </div> <br /><br /> <div class="student_text"> <asp:RadioButton ID="RadioButton4" GroupName="reg" Text="myaccount" runat="server" onclick="return getCheckedValue4();" /> <br /> <%--OR how do i get it to work when using a URL as shown below for example--%> <a href="navPageTest2.aspx" onclick="getClickedValue4();">Myaccount_link_ex</a><br /> </div> <br /><br /> ****************************** start display ***************************** <br /><br /> <div id="presentationsNavBars" style="display: none;"> SOME HTML HERE ..........presentations nav bar............ </div> <div id="proposalsNavBars" style="display: none;" > SOME HTML HERE 44444444 proposals nav bar 44444444444 </div> <div id="postingsNavBars" style="display: none;" > SOME HTML HERE 2222222 postings nav bar 2222222222222 </div> <div id="myaccountNavBars" style="display: block;" > SOME HTML HERE 33333333 myaccount nav bar 33333333 </div> <br /><br /> ****************************** end ***************************** Hello all. I am working on a userscript for a site that grabs some weather information for each NFL game. I am trying to loop GM_xmlhttpRequest(s), which has worked okay, but doesn't seem to mix well with arrays. By that I mean I am attempting to push values onto an array, but it doesn't seem to work. So basically at the bottom of the code below, I get values for wind, but not for each windArray[i]. My hunch is that has something to do with the asynchronous behavior of GM_xmlhttpRequest, but I am wondering if there is anyway around that (coding wise). I greatly appreciate any input you can provide. Code: //Strips all html elements from a string String.prototype.stripTags = function() { return this.replace(/<\/?[^>]+>|&[^;]+;|^\s+|\s+$/gi,''); } var weatherURL = new Array(); weatherURL[0] = 'http://www.nflweather.com/game/2011/week-1/bills-at-chiefs'; weatherURL[1] = 'http://www.nflweather.com/game/2011/week-1/bengals-at-browns'; weatherURL[2] = 'http://www.nflweather.com/game/2011/week-1/steelers-at-ravens'; var windArray = new Array(); function getDOC(url, callback) { GM_xmlhttpRequest({ method: 'GET', url: url, onload: function (responseDetails) { var dt = document.implementation.createDocumentType("html", "-//W3C//DTD HTML 4.01 Transitional//EN", "http://www.w3.org/TR/html4/loose.dtd"), doc = document.implementation.createDocument('', '', dt), html = doc.createElement('html'); html.innerHTML = responseDetails.responseText; doc.appendChild(html); callback(doc); } }); } for (var i=0; i<weatherURL.length; i++) { getDOC(weatherURL[i], function(doc) { var pageTds = doc.getElementsByClassName('no-line'); var wind = pageTds[9].innerHTML.stripTags(); //alert(wind); windArray.push(wind); //alert(windArray[i]); }); } Hello I am trying to create a form which when the submit button is selected will open a new window with 1 of 4 URLs based on the the combination of data in 2 select boxes. For example: if select box 1 = a and select box 2 = a then open new window with URL 1 if select box 1 = a and select box 2 = b then open new window with URL 2 if select box 1 = b and select box 2 = a then open new window with URL 3 if select box 1 = b and select box 2 = b then open new window with URL 4 Any help would be greatly appreciated. Thanks Daniel Hello I am trying to create a form which when the submit button is selected will open a new window with 1 of 4 URLs based on the the combination of data in 2 select boxes. For example: if select box 1 = a and select box 2 = a then open new window with URL 1 if select box 1 = a and select box 2 = b then open new window with URL 2 if select box 1 = b and select box 2 = a then open new window with URL 3 if select box 1 = b and select box 2 = b then open new window with URL 4 Any help would be greatly appreciated. Thanks Daniel Hello, How I can detect URLs in a larger body of text using a regular expression in javascript. For ex.: I type this text in my form and I saved in database: My home page is http:// www. mypage .com.it And in my site I want to appear like he My home page is http://www.mypage.com.it I would like to call a function within a function. Is this even possible?? When I do this I get "undefined" Here's my code: Code: <html> <head> <script type="text/javascript"> function product(a,b){ total = a*b; display(total); } function display(num){ return num; } </script> </head> <body> <h1>This text I do NOT want to be erased.</h1> <a href="http://google.com" target="_blank">Total: </a> <script type="text/javascript"> product(3,4); document.write(display()); </script> </body> </html> I know you can just return in the first function, "product()" but I would like to do something else in my second function "display()" then return a value. thanks New here. The issue is this: I am trying to display two clocks. I used the javascript clock generator (http://rainbow.arch.scriptmania.com/...generator.html) to create both clocks. However, the same code to place in the html was given to call each clock; <script language="JavaScript">displayTime();</script>. Below is the code for both clocks. What can be changed so that each clock displays on my website? Clock 1: function timeSource(){ x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours (),timeNow().getUTCMinutes(),timeNow().getUTCSeconds()); x.setTime(x.getTime()+10800000); return x; } function timeNow(){ return new Date(); } function leadingZero(x){ return (x>9)?x:'0'+x; } function twelveHour(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; } function displayOnTime(){ if(fr==0){ fr=1; document.write('<font size=1 face=verdana><b><span id="tP">'+eval(outputTime)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(outputTime); setTimeout('displayOnTime()',1000); } function amPMsymbol(x){ return (x>11)?'pm':'am'; } function fixYear4(x){ return (x<500)?x+1900:x; } var dayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December'); var fr=0; var outputTime1="dayNames[timeSource().getDay()]+' '+timeSource().getDate()+' '+monthNames[timeSource().getMonth()]+' '+fixYear4(timeSource().getYear())+' '+':'+':'+' '+twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+':'+leadingZero(tim eSource().getSeconds())+' '+amPMsymbol(timeSource().getHours())"; Clock 2: function timeSource(){ x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours (),timeNow().getUTCMinutes(),timeNow().getUTCSeconds()); x.setTime(x.getTime()+daylightSaving()-18000000); return x; } function timeNow(){ return new Date(); } function daylightSaving(){ return ((timeNow().getTime()>findDay(0,2,3,2).getTime())&&(timeNow().getTime()<findDay(0,10,3,1).getTime()) )?3600000:0; } function findDay(d,m,h,p){ var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(timeNow().getUTCFullYear(),nm,1,h,0,0),dOff=0; if(p<0){ x.setTime(x.getTime()-86400000); } if(x.getDay()!=d){ dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d); if(p<0&&dOff>0){ week-=7; } if(p>0&&dOff<0){ week+=7; } x.setTime(x.getTime()+((dOff+week)*86400000)); } return x; } function leadingZero(x){ return (x>9)?x:'0'+x; } function twelveHour(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; } function displayTime(){ if(fr==0){ fr=1; document.write('<font size=2 face=Arial><b><span id="tP">'+eval(outputTime)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(outputTime); setTimeout('displayTime()',1000); } function amPMsymbol(x){ return (x>11)?'pm':'am'; } function fixYear4(x){ return (x<500)?x+1900:x; } var dayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December'); var fr=0; var outputTime="dayNames[timeSource().getDay()]+' '+timeSource().getDate()+' '+monthNames[timeSource().getMonth()]+' '+fixYear4(timeSource().getYear())+' '+':'+':'+' '+twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+':'+leadingZero(tim eSource().getSeconds())+' '+amPMsymbol(timeSource().getHours())"; Hi, How can i call a javascript alert function from an if condition in PHP? For instance: if (A == B) { CALL alert(); } thanks I've done a lot of work only to be stuck here at this problem. someone please help: Using the today variable as the parameter value, call the showDateTime() function and store the value returned by the function in the thisDay field of the eventform Web form. what exactly is this asking me to do? would you provide examples please? thanks in advance!@ Hey guys, I'm trying to call the following custom tag: <mvt:item name="category_tree" /> from a JS function: <script language="javascript" type="text/javascript"> <!-- function left_nav_bar () { document.write('Categories:'); document.write('<mvt:item name="category_tree" />'); } //--> </script> But the custom tag is not executing in the browser. Am I calling it wrong from my JS code? in HTML you can call CSS Code: <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <tr><td class="cssHere">Display</td></tr> can you even call CSS in javascript? Code: document.writeln("<tr><td class="cssHere">" + Display + "</td></tr>"); if so how do you even call the "style.css" thanks I am in a class that is right now creating an online quiz that is also displays time. The part I am running into a wall right now is "Call the runClock() function every second, storing the ID of this timed-interval command in the clockId variable." I am unsure how to call it every second. Also, how would I call a function within a function? Here is my code so far: <link href="quiz.css" rel="stylesheet" type="text/css" /> <script src="functions.js" type="text/javascript"></script> <script type="text/javascript"> var seconds = 0 var clockID = function runClock() { clockID = seconds++; document.getElementById("quizclock").value = seconds; } function startClock() { return showQuiz; } </script> </head> |