JavaScript - How Can I Change Entries_url To Load From Local File
Hello to all ...
I am very basic on this of javascript, so someone could help me how to resolve this issue. I have a javascript (HTML internal), which fetches and executes a file in another web address... but I do not want it to do that, i want this script to execute is function directly from my local disk (file location). Here is the script; Code: <html> <head></head> <body> <div style="WIDTH: 984px; HEIGHT: 443px" > <script type="text/javascript"> var previewConfigs = [{ type: 'flash', preview_url: "http://myflashtest.com/files/9083/preview.swf", base: "http://myflashtest/files/9083/" }]; </script> <span id="large_item_preview"> <object style="visibility: visible; Z-INDEX: 0; WIDTH: 590px; HEIGHT: 300px; TOP: -51px; LEFT: -27px; " id="large_item_preview_container" data="srcs-ff/preview.swf"></object> </span> <script type="text/javascript" src="srcs-ff/jquery.js"> </script> <script type="text/javascript" src="srcs-ff/preview.js"> </script> <script type="text/javascript"> if (typeof(previewConfigs) !== 'undefined') { for (var i = 0; i < previewConfigs.length; i += 1) { var preview = new ItemPreview(previewConfigs[i]); preview.display(); }; }; </script> <script type="text/javascript"> $(document).ready(function() { $("tr[data-accessor=source]").click(); }); </script> </div> </body> </html> <b>What I want is to change this part;</b>; preview_url: "http://myflashtest.com/files/9083/preview.swf", base: "http://myflashtest/files/9083/" Similar TutorialsI am working on a web app for the iPad and I am storing all my content in cookies. I am wondering how easy it is to transfer it to Local Storage. I'll post all the scripts that set cookies below: Code: jQuery.cookie = function (a, b, c) { if (typeof b !== "undefined") { c = c || {}; if (b === null) { b = ""; c.expires = -1; } var d = ""; if (c.expires && (typeof c.expires === "number" || c.expires.toGMTString)) { var e; if (typeof c.expires === "number") { e = new Date(); e.setTime(e.getTime() + c.expires * 24 * 60 * 60 * 100000); } else { e = c.expires; } d = "; expires=" + e.toUTCString(); } var f = c.path ? "; path=" + c.path : ""; var g = c.domain ? "; domain=" + c.domain : ""; var h = c.secure ? "; secure" : ""; document.cookie = [a, "=", encodeURIComponent(b), d, f, g, h].join(""); } else { var i = null; if (document.cookie && document.cookie !== "") { var j = document.cookie.split(";"); for (var k = 0; k < j.length; k++) { var l = jQuery.trim(j[k]); if (l.substring(0, a.length + 1) === a + "=") { i = decodeURIComponent(l.substring(a.length + 1)); break; } } } return i; } }; $(window).unload(function () { $(".remember").each(function () { $.cookie(this.id, this.value, { expires: 365 }); }); $(".draggable").each(function () { var a = $(this); $.cookie(this.id, a.css("top") + "_" + a.css("left"), { expires: 365 }); $.cookie("disp" + this.id, a.css("display"), { expires: 365 }); }); }); $(function () { var a, b, c; setInterval(checkOrientAndLocation, 1000); $(".remember").each(function () { var a = $.cookie(this.id); if (a) { this.value = a; } }); $(".draggable").each(function () { var a = $.cookie(this.id); if (a) { a = a.split("_"); $(this).css({ position: "absolute", top: a[0], left: a[1] }); } var b = $.cookie("disp" + this.id); if (b) { this.style.display = b; } }).touch({ animate: false, sticky: false, dragx: true, dragy: true, rotate: false, resort: false, scale: false }); }); function toggle_visibility(a) { var item = $("#" + a); item.fadeToggle(); $.cookie("disp" + a, item.css("display")); } var _target = null, _dragx = null, _dragy = null, _rotate = null, _resort = null; var _dragging = false, _sizing = false, _animate = false; var _rotating = 0, _width = 0, _height = 0, _left = 0, _top = 0, _xspeed = 0, _yspeed = 0; var _zindex = 1000; jQuery.fn.touch = function (a) { a = jQuery.extend({ animate: false, sticky: false, dragx: true, dragy: true, rotate: false, resort: false, scale: false }, a); var b = []; b = $.extend({}, $.fn.touch.defaults, a); this.each(function () { this.opts = b; this.ontouchstart = touchstart; this.ontouchend = touchend; this.ontouchmove = touchmove; this.ongesturestart = gesturestart; this.ongesturechange = gesturechange; this.ongestureend = gestureend; }); }; var currentRotation = null; function setOrientation() { switch (window.orientation) { case 0: orient = "portrait"; break; case 90: orient = "landscape"; break; case -90: orient = "landscape"; break; } currentRotation = window.orientation; document.body.setAttribute("orient", orient); setTimeout(scrollTo, 0, 0, 1); } function checkOrientAndLocation() { if (currentRotation !== window.orientation) { setOrientation(); } } function gestureend(a) { _sizing = false; _rotating = (_rotating + a.rotation) % 360; } function gesturechange(a) { if (_sizing) { _width = this.opts.scale ? Math.min(parseInt(_sizing[0], 8) * a.scale, 300) : _sizing[0]; _height = this.opts.scale ? Math.min(parseInt(_sizing[1], 10) * a.scale, 300) : _sizing[1]; _rotate = this.opts.rotate ? "rotate(" + (_rotating + a.rotation) % 360 + "deg)" : "0deg"; $("#" + this.id).css({ width: _width + "px", height: _height + "px", webkitTransform: _rotate }); $("#" + this.id + " b").text(""); $("#" + this.id).css({ backgroundColor: "" }); } } function gesturestart(a) { _sizing = [$("#" + this.id).css("width"), $("#" + this.id).css("height")]; } function touchend(a) { $(a.changedTouches).each(function () { if (!a.targetTouches.length) { _dragging = false; if (_animate) { _left = $("#" + _target).css("left") === "auto" ? this.pageX : parseInt($("#" + _target).css("left"), 10); _top = $("#" + _target).css("top") === "auto" ? this.pageY : parseInt($("#" + _target).css("top"), 10); var b = _dragx ? _left + _xspeed + "px" : _left + "px"; var c = _dragy ? _top + _yspeed + "px" : _top + "px"; if (_dragx || _dragy) { $("#" + _target).animate({ left: b, top: c }, "fast"); } } } }); $("#" + _target + " b").text(""); $("#" + _target).css({ backgroundColor: "" }); } function touchmove(a) { if (_dragging && !_sizing && _animate) { var b = isNaN(parseInt($("#" + _target).css("left"), 10)) ? 0 : parseInt($("#" + _target).css("left"), 10); var c = isNaN(parseInt($("#" + _target).css("top"), 10)) ? 0 : parseInt($("#" + _target).css("top"), 10); } $(a.changedTouches).each(function () { a.preventDefault(); _left = this.pageX - parseInt($("#" + _target).css("width"), 10) / 2; _top = this.pageY - parseInt($("#" + _target).css("height"), 10) / 2; if (_dragging && !_sizing) { if (_animate) { _xspeed = Math.round((_xspeed + Math.round(_left - b)) / 1.5); _yspeed = Math.round((_yspeed + Math.round(_top - c)) / 1.5); } if (_dragx || _dragy) { $("#" + _target).css({ position: "absolute" }); } if (_dragx) { $("#" + _target).css({ left: _left + "px" }); } if (_dragy) { $("#" + _target).css({ top: _top + "px" }); } if (_dragx || _dragy) { $.cookie(_target, ($("#" + _target).css("top") || "") + "_" + ($("#" + _target).css("left") || "")); } $("#" + _target).css({ backgroundColor: "" }); $("#" + _target + " b").text(""); } }); } function touchstart(a) { _target = this.id; _dragx = this.opts.dragx; _dragy = this.opts.dragy; _resort = this.opts.resort; _animate = this.opts.animate; _xspeed = 0; _yspeed = 0; $(a.changedTouches).each(function () { var b = $("#" + _target).css("left") === "auto" ? this.pageX : parseInt($("#" + _target).css("left"), 10); var c = $("#" + _target).css("top") === "auto" ? this.pageY : parseInt($("#" + _target).css("top"), 10); if (!_dragging && !_sizing) { _left = a.pageX - b; _top = a.pageY - c; _dragging = [_left, _top]; if (_resort) { _zindex = $("#" + _target).css("z-index") === _zindex ? _zindex : _zindex + 1; $("#" + _target).css({ zIndex: _zindex }); } } }); } function killAllCookies() { $(window).unbind("unload"); var a = document.cookie.split(";"), b = a.length - 1; for (b; b > -1; --b) { $.cookie(a[b].split("=")[0], "", { expires: -1 }); setTimeout("location.reload(true);", 1); } } I realize this is a big thing to ask, so if anyone has some free time and possibly wants to help me, I would be extremely thankful. is "localStorage" a native variable to javascript? On lin 36 & 37 is there anything else involved in getting that local storage to store? Those lines are local storage right? Is it really that easy? I was just reading this HUGE post and immediately stressed me out. I'm used to working off small examples and diving in bit by bit. It was the first article on google so I trusted it to be the most appropriate for introductions. (which means not reading more than 500 words before I get some sample code) In addition, can Google Chrome & FireFox extensions change page elements? The reason I think it can do this is because google chrome says this Which (to me) implies that the extension has access to page data. If that is the case. How are localStorage variables not mixing? How can I access that page data? I don't care about browser history, I just want to change page elements. Is this possible? If this is the case. Is there a way I can have the extension close itself or not open at all? Sometimes I just want the "extension" to provide a simple function. That's all. Thanks! I had Silverbird and the tutorialzine example extension. They were both different size. Odd thing is that I never saw a size specification in the style.css in the tutorialzine example. How can I specify the size of the popup extension? Hi all. I have text area that includes the full path for a local file on our company network. The files are usually excel sheets or docs. How can I have it so when they clicks the file it opens the local file?
Hello. I'm trying to improve page loads times on my site and I've tracked the issue down to the share buttons we have. We load the Tweet Button, Facebook Like Button, and Google +1 button sometimes up to 25 times on one page. What I'd like to do is, on initial load, display an image that looks like the Tweet Button, for example, and then when hovering over a div, change to the actual Tweet Button code. I know how to do this in general, but the key is that the actual tweet button code doesn't load when the page loads, only when you hover over the div does the actual code load. Can someone please give me a general template and I can integrate it in with my site? Thanks. It must be a simple thing... I am trying to change an image source on page load depending on the contents of a cookie: Code: function goVisited(cookiename,img_name,img_src) { var visited = readCookie(cookiename); if (visited == "1"){ //alert("visited!"); document[img_name].src=img_src; }} <img onload="goVisited('main1','Introduction','img/Yellow.gif');" name="Introduction" border="0" src="img/Green.gif" width="250" height="18"> I need the page to check the cookie "main1" and if its value is 1, then change the image src from Green.gif to Yellow.gif. It almost works, but I get a stack overflow. Hi there, Can anybody help me to write php/javascript code which will allow users to open files directly from web browser into desktop application? Here is the specification: I have a photo editing business with many people working in Photoshop. I am currently developing a web based application (joblist) using Javascript and PHP which should allow the photoshop designers to browse and open files/images directly from joblist/web browser into photoshop. The reason I want this instead of browsing folder is that I have a database where I store who worked on which file, when and how long it took. The concept is that, designers will select a file and click on start, as soon as they click on start the original file will open in Photoshop and there will be an entry into database (using PHP). Once they finish the task they will close the file and click on Finish button. My joblist application will be published in a local server and the file will be open on a local network, so when they save the file it will be saved where the source file is located in (local server). The application should work in both PC and Mac. I have already done all other part of the application except file opening directly from browser to desktop application functionality. Anybody can help me to write the code (PHP or Javascript) which can open the file from browser (local server) directly into desktop application e.g. PHotoshop or Illustrator? Thank you very much I look forward to someone's real help! Best regards Mr. Sumon Hi there, I have a photo editing business with many people working in Photoshop. I am currently developing a web based application (joblist) using Javascript and PHP which should allow the photoshop designers to browse and open files/images directly from joblist/web browser into photoshop. The reason I want this instead of browsing folder is that I have a database where I store who worked on which file, when and how long it took. The concept is that, designers will select a file and click on start, as soon as they click on start the original file will open in Photoshop and there will be an entry into database (using PHP). Once they finish the task they will close the file and click on Finish button. My joblist application will be published in a local server and the file will be open on a local network, so when they save the file it will be saved where the source file is located in (local server). The application should work in both PC and Mac. Anybody can help me to write the code (PHP or Javascript) which can open the file from browser (local server) directly into desktop application e.g. PHotoshop or Illustrator? Thank you very much I look forward to someone's real help! Best regards Mr. Sumon www.clippingpathindia.com I doubt this is possible, but I have no idea what actually happens when a page loads, so I thought I would give it a shot... if a js file that is loaded externally has parameters, is it possible to turn those parameters into variables, giving the user the option to select the variable's value after the page has loaded? maybe a concrete example would be better... in google maps, the api is loaded like this: Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> but if you wanted to specify that you want the api to function in Spanish, you load it like this: Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=es"></script> and that language=es is the one that I want to change. But I can't seem to make it into a variable on page load, like this: Code: <script type="text/javascript"> var lang="es"; </script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=lang"></script> much less make it changeable once the page has loaded. I have a feeling that this is a really dumb question, but can it be done without reloading the entire page? Hello all, I am new here and have a question about a AP Div I am using as a dropin. It drops in when the page loads and I would like it to only drop in if a visitor clicks a link I designate as the dropin link. Can someone please tell me how to accomplish this? I am pasting in the js file and I will also need to know how to set up the "a href" link to call the dropin! Thanks is advance for any help you may give! Code: // JavaScript Document var ie=document.all var dom=document.getElementById var ns4=document.layers var calunits=document.layers? "" : "px" var bouncelimit=32 //(must be divisible by 8) var direction="up" function initbox(){ if (!dom&&!ie&&!ns4) return crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin scroll_top=(ie)? truebody().scrollTop : window.pageYOffset crossobj.top=scroll_top-250+calunits crossobj.visibility=(dom||ie)? "visible" : "show" dropstart=setInterval("dropin()",50) } function dropin(){ scroll_top=(ie)? truebody().scrollTop : window.pageYOffset if (parseInt(crossobj.top)<100+scroll_top) crossobj.top=parseInt(crossobj.top)+40+calunits else{ clearInterval(dropstart) bouncestart=setInterval("bouncein()",50) } } function bouncein(){ crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits if (bouncelimit<0) bouncelimit+=8 bouncelimit=bouncelimit*-1 if (bouncelimit==0){ clearInterval(bouncestart) } } function dismissbox(){ if (window.bouncestart) clearInterval(bouncestart) crossobj.visibility="hidden" } function truebody(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } window.onload=window.setTimeout(initbox,5000); I have several js files to include in Hml so was thinking if there is any way that i can includes all the files in one file and then include that file in the main html file so that i don't need to chnage the main file again and again How can i do that just like we use import in css There are other similar topics, but this one is different. I am making an external js file and I want to use prototype.js with it. I don't want it in the html file that is referencing the .js file, I actually want to use prototype in the .js file. I'd just rather not copy the 4,000 lines of prototype if there is an easier way to do it. Sorry if I'm not being clear, but thanks for the help in advance. Jazzo Hi guys. I've made a html file with three lists to populate different pages of my site. Then i've called the html with SSI. let me show the code the HTML with the list's Code: <div id="list_box"> <ul class="list"> <li><a href="#">item01</a></li> <li><a href="#">item02</a></li> <li><a href="#">item03</a></li> <li><a href="#">item04</a></li> <li><a href="#">item05</a></li> </ul> </div> <div id="list_box"> <ul class="list"> <li><a href="#">item06</a></li> <li><a href="#">item07</a></li> <li><a href="#">item08</a></li> <li><a href="#">item09</a></li> <li><a href="#">item10</a></li> </ul> </div> <div id="list_box"> <ul class="list"> <li><a href="#">item11</a></li> <li><a href="#">item12</a></li> <li><a href="#">item13</a></li> <li><a href="#">item14</a></li> <li><a href="#">item15</a></li> </ul> </div> the HTML with the list loaded Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- #list_box { height:100%; width: 100%; padding-top: 15px; padding-left: 30px; padding-right: 30px; padding-bottom: 20px; background-color: #cccccc; overflow: hidden; } ul.list li { list-style-type: none; text-align: left; text-decoration: none; } .list a:link, .list a:visited { font-family: "Courier New", Courier, monospace; font-size: 12px; line-height: 15px; color: #036; text-decoration: none; text-align: left; font-weight: bold; font-style: normal; } .list a:hover{ font-family: "Courier New", Courier, monospace; font-size: 12px; line-height: 15px; color: #ffffff; text-decoration: none; text-align: left; font-weight: bold; font-style: normal; } --> </style> </head> <body> <div id="list_box"> <!--#include file="list.html" --> </div> </body> </html> the zip with the sample I've made load_external.zip I wanted to ask how can I make an item from the list's to have a different css in the html with the loaded list's. because in each page one of the items (that are all buttons) will be up or should I say active. can someone tell me how can I do this please. Maybe with javascript? thanks in advance Hi anyone knows a lightbox that can be called like this? Code: <img src="imgs/edit.png" border="0" onclick="lightbox.open( 'test.php' ,'test');" style="cursor : pointer;"> or modify slimbox to work with iframe? sorry for bad english Thanks So I was reading up on how to load and parse an XML file into an html page and I found through w3 a great tutorial with sample code: http://www.w3schools.com/xml/xml_dom.asp It appears to work fine on their website but when I try it from my desktop it doesn't work. So what I have is an html file with contents: Code: <html> <body> <h1>W3Schools Internal Note</h1> <div> <b>To:</b> <span id="to"></span><br /> <b>From:</b> <span id="from"></span><br /> <b>Message:</b> <span id="message"></span> </div> <script type="text/javascript"> if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","note.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; document.getElementById("to").innerHTML= xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; document.getElementById("from").innerHTML= xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue; document.getElementById("message").innerHTML= xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue; </script> </body> </html> And then the xml file named "note.xml": Code: <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> I have no idea what I am missing or not seeing that is causing this not to work but if anyone knows I would appreciate the input. For the record I have tried this in chrome and ie. So I'm trying to make a free flash game site that is not completely annoying and never redirects you to another site. i'm hosting all my flash games on my server. when you select the game you would like to play, it loads the file name into a javascript variable that gets sent to my game.html where i would like the game to load. every game should load on this same page. I cannot for the life of me find how to read the variable in html. I've tried embed, object, documentwrite, basically everything i could find doing google searches for 10 hours. I'm no expert programmer, but I've never had to post a question to any forum EVER before because I always figure it out on my own. Not this time. i don't want to include any code i'm using because i would like the proper format. tell me what to do with it and i will do anything in my power to make you feel special. i'll devote a special page to you highlighting your genius on my site. this is a terrible example of what I'm trying to do, just imagine VARIABLEGOESHERE = mystinkingame.swf: [CODE] <object width="550" height="400"> <param name="movie" value="VARIABLEGOESHERE"> <embed src="VARIABLEGOESHERE" width="550" height="400"> </embed> </object> [CODE] it is also clear that i do not understand the [CODE] tag in your forum. That's right, I want to load a random html file from a list into a another div. Does anyone knows any example, please? It would be very helpful. Thanks Hello, I have a DFXP formatted XML file (used for closed captioning), and I have tried several times unsuccessfully to load and show its contents on screen using js. Here is what the XML looks like Code: <tt xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling" xmlns="http://www.w3.org/2006/04/ttaf1" xml:lang=""> <head> <styling> <style tts:fontSize="14" tts:textAlign="center" tts:wrapOption="wrap" id="1"/> </styling> </head> <body> <div xml:lang="en"> <p begin="00:00:01.45" style="1" end="00:00:03.55"> PROFESSOR: Welcome to your <br/> virtual classroom. </p> </div> </body> </tt> I have the URL of the file and all I want to do is print the text onto the screen (the "PROFESSOR: Welcome to your virtual classroom." portion). If anyone can help me out I would greatly appreciate it, I'm stuck! I have a question is it bad or what are the disadvantages of doing what I am going to explain. I want to put the same javascript file two time in the same page e-g Code: <script type="text/javascript" src="http://www.mydomain.com/javascript.js"></script> <script type="text/javascript" src="http://www.mydomain.com/javascript.js"></script> Now many people will ask why would I want to do that, well the reason is that I am using blogger and blogger doesn't let me see all code from which the page is made rather split it into two parts named as POSTS and EDIT HTML. So I am going to place this script in those both areas but at the end when the page loads it is actually going to two the same script two times which is not error. Another question would be why am I not using same script in one place rather than two places if at the end the page code is going to become one. Well the answer would be because that script is used by other scripts too so I CAN'T CHANGE THE LOCATION if I do so, then the script stops working. I have looked all over for an answer to this, but haven't found a definite way to do it yet. I am updating my audio page (a demo track list for getting composing work) and getting rid of my flash audio player in favor of embedding .mp3 files, or adding them with the HTML5 audio tag. What I would like to be able to do is link into the page, and have that link autoplay a specific track out of the 10-20 that I will have on the same page. The problem is I am extremely new to scripting and have no idea where to even start with this. The reason I want it to be able to autoplay specific tracks is so I can market a specific track, and have that person (who is already expecting to hear the music on page load) not have to then look through the track list for that one track I was promoting and click play. Any help would be greatly appreciated, Thanks! |