Referencing Files Relative To The .js File ?

Feb 18, 2011

I'm writing a JS script that will be available as open source. This script needs some accompanying image files. I have been planning to package the .js and the image files together in a single directory and let the user put that directory anywhere they want. Trouble is, I can't figure out how to write JS code to put a reference to these image files into the html. The image files are relative to the .js file, but I haven't seen anyway to figure out the path to the .js file (i.e. the path to the code I am now running). Is there a way? If not, how do people usually package up a .js file and some accompanying image files?

View 11 Replies


ADVERTISEMENT

Relative Paths To External Files

Oct 12, 2011

I have a simple php webpage that links to an external javascript file:

But I want to avoid this:

I've seen so much on the web for Ajaz, ASPX etc. and it all looks a little confusing.

Using ../php/myphp.php works well for php files, what's the way to do it with javascript?

View 9 Replies View Related

Ajax :: Include File In File Not Working At The Time Of Files Is Called

Apr 27, 2009

When the JS file is not working at the time of Ajax files is called. on first time the onmouseover JS is working but , if you call the ajax JS is not working.

View 2 Replies View Related

Referencing A .js File From Within Another .js File?

Jul 10, 2009

I was wondering if you can reference another javascript file from within a javascript file.I have tried using document.write("<script type='text/javascript' src='somefile.js'></script>"); but that doesn't seem to work.So I am wondering if there is another way to do it or if I am just doing it wrong.

View 2 Replies View Related

Replace Image File Path With Relative Path To File Name

Apr 27, 2009

I'm using a script to include images into a slide show using direct URLs to the image files, but I am using fckeditor (PHP) for my users to edit their content. The script in the .js file that pulls the images into the slide show.The user's image file is going to be named something like, "userImage01.php". Inside that file would be their image location path ~ "images/user/image1.jpg".Therefore, I need the above javascript to pull-in "userImage01.php" INSTEAD OF the image's location path.

View 10 Replies View Related

Load 3-4 Js Files In Another Js File?

Oct 20, 2009

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

View 5 Replies View Related

Access Files In File Input?

Oct 27, 2010

I am trying to upload multiple files using file input. And I am able to do that using "multiple" attribute of input type file. I can not use file API as I am using python on server side. So after user has selected the files, I want to access those file names in file input to let user cancel any file before uploading and upload rest of the files. The "value" attribute of input file does not work as it doesn't let me write.

View 5 Replies View Related

JS Files Not Working As An External File?

Jun 4, 2009

I have an advertising script , its embedded on the html page . here is the code from the HTML

Code:
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'Linkhere':'Linkhere');
var m3_r = Math.floor(Math.random()*99999999999);

[Code]....

View 1 Replies View Related

File Type Of Uploaded Files?

Aug 28, 2005

how do i check the file type of a file being uploaded using jsp?
i need to user to be able to upload images only..

View 1 Replies View Related

JQuery :: Php - Drag And Drop Files - How To Get File Info

Nov 12, 2009

Interested in building my own drag'n'drop file uploader using JQuery/AJAX/PHP. Basically I want a file-uploader that users of my site can just drag the file from their computer into a div I created, and it will then upload the file for them to the selected destination.

I would like to build this from scratch, and not use any plugins so that I can better manipulate the restrictions (file types, size, destination folders, etc.)Have scoured google with no luck, only plugins. Can anyway steer me in the right direction?

UPDATEI: how to do what I want. Just set the file input field opacity to 1 so it is hidden, and you can still drag a file into that general area and if you hit the text field it will catch it. HOWEVER, I would like to know how to increase the height/width on the file input field (tried basic css on the file, but it only increases the 'browse' button size and not the actual field where you can drop the file into. I basically want a big square div that says 'Drop file here'. So I need to resize the input field.

View 19 Replies View Related

Remove Uploaded File And Give Limit To Upload Files?

Feb 5, 2009

I have used this script for multiple upload using one file control. In this i have give limit for upto 3 times user can upload. also user can remove which is uploaded. But main problem is when user remove last uploaded file than its ok but when user remove first uploaded file and then add new file that time user can upload more than 3 files? Whats the problem I can`t found.

My script is

<script language="jscript" type="text/javascript">
function getCount() {
var cnt = 0;
for ( var i = 0; i < upload_number; i++ ) {

[Code]....

View 3 Replies View Related

Mail Service - Attach Some Excel Files Of Text Files And To Send It

Aug 16, 2010

I have designed a mail service in java.In my compose page,i want to attach some excel files of text files and to send it.After sending i want to store it my database.Then how can i download or open that file after opening that recipient mail inbox.

View 1 Replies View Related

XMLHttpRequest Script - Works For Local XML Files But Not For External XML Files?

Oct 2, 2010

I have the following JavaScript (see below). The script requests an XML file from the server and displays it on the page.The script works fine when the requested XML file is stored on the same server as the script.The problem is when I try requesting an XML file from an external server such as the National Weather Service. I get an error. If I take the XML file from the National Weather Service and save it to my server it works. Why can't I use my script to request XML files stored on external servers?

Javascript Code

Code:

window.onload = initAll;
var xhr = false;
function initAll() {
document.getElementById("makeTextRequest").onclick = getNewFile;

[code]....

View 6 Replies View Related

Customising "Upload Multiple Files With A Single File Element" Script

Jan 9, 2006

I am currently testing StickBlog's Upload multiple files with a single file element and need some help. I would like the files to be placed into a definition list with the delete button before the file. Can anyone provide an example showing how I would do this?

View 2 Replies View Related

JQuery :: Ajax Request Works With .xml Files But Not .php Files?

Aug 27, 2010

In my quest to implement ajax for the first time i've hit a brick wall. i've been searching for hours for a solution but with no success. Here is the problem.

[Code]...

why is it not working? my PHP code is outputting the contents of the xml document.

View 1 Replies View Related

List All Files In A Folder Including Subfolder Files?

Sep 5, 2008

I want to write a javascript to list of all files in a folder including files in the subfolders. This is for the scorm purpose to list all the files. some examples are listing files but not listing the files inside the subdirectories. I want the file's full path like C:Documentsjavascriptwilson.js like this.

View 5 Replies View Related

Show Images From Four Files - Each Files Are In Each Folder?

Jan 15, 2010

I have four folders and each folder has one images, let say ( images-one.jpg, images-two.jpg, images-three.jpg, images-four.jpg). now,in index.php page there are four buttons, each buttons for each images. if i clicked button numer two for images-two.jpg, and then it will show that images name from that folder in index.php page. and then if i reload same index.php page or refreshed same page, i want to show SAME images that I clicked before which is images-two.jpg. how can i write that code to show images from four files, each files are in each folder.

View 1 Replies View Related

Referencing Value

Oct 6, 2004

I'm trying to get a value from a link that a user click on in a pop up window and send it back to the parent window. It's working fine in mozilla and some IE but i'm having problem in IE 5 and some IE 6.

<a href="javascript:opener.document.getElementById('<?php echo $_REQUEST[partid];?>_partremoved').value = '<?php echo $partnum;?>'
opener.document.getElementById('<?php echo $_REQUEST[partid];?>_partinstalled').value = '<?php echo $partnum;?>'window.close();">
<?php echo $partnum;?></a>

View 4 Replies View Related

Referencing A <tr> Object

Jul 23, 2005

if i have this code: <form><input type=text name="id1"></form> then with
javascript i can reference this with this.form.id1, how can i reference
something like this:

<table>
<tr name="id2">
..
..
</table>

?

this.id2 doesn't work

View 5 Replies View Related

Referencing A DIV Within A Form?

Oct 29, 2009

whenever I run the below code I am unable to hide my <DIV>. I have posted a previous post regarding hiding DIVs however as this is slightly different I thought I would create a new topic here to allow for easier searching for other users.

The below code works if the DIV is outside of the form however if I enter it within the form nothing happens.

<form name="formcreate" method="post" action="">
<table width="80%" border="0" cellspacing="2" cellpadding="2">
<div id="div1">
<tr>

[Code].....

View 4 Replies View Related

Referencing Other Page's Dom

Aug 28, 2007

Is there a way in the Javascript to reference the dom of another page that is online. An example would be if www.cnet.com has an element with an id = money can I reference that page with an object that and get a value from the money element and display it on my page. I know this sounds confusing but really i just want to be able to save a xhtml page that is not on my website. Create a input filestream from that page and use data from the filestream to make data on my own page.

View 1 Replies View Related

Referencing An Object's Fieldnames

Apr 12, 2006

A have an array of objects defined like this:

var collegas =
[{smtp:'alberic.verhelst@king.dom',voornaam:'Alberi c',famnaam:'Verhelst'},
{smtp:'anita.dierens@king.dom',voornaam:'Anita',fa mnaam:'Dierens'}, etc


I iterate over this array with this code :

for (var i = 0, stop=collegas.length ; i < stop ; i++) {
for (var veld in collegas[i]) {
etc

I would like to check whether a particular veld instance's name is smtp. In
code what I want is this :
if (veld.fieldName=="smtp") { do something ...

But this syntax doesn't work.....

View 2 Replies View Related

Referencing Parameters In JS, POST Vs. GET

Jul 20, 2005

I would like to reference the "name=value" parameters sent to my page
(submit'ted from a previous page with a <form>.) in my javascript.

I can do it if my second form is called with a "get" using the
window.location.search property, etc.

I don't know where these parameters are if my second page is called with a
"post"...

View 1 Replies View Related

Referencing A Function Through An Array?

Jun 1, 2010

I am loading a set of icons using an array. The reason for this is that the icon set will be different depending on what some PHP code has given to the JavaScript.

My code currently looks like this.

Code:

var things_to_load = new Array();
things_to_load['header_cursors'] = new Array( 'default' , 'pointer' );
things_to_load['header_icons'] = new Array( '../img/triggers/to-roll/undo.png' , '../img/triggers/add.png' );
things_to_load['header_labels'] = new Array( 'undo' , 'add' );

[Code].....

The problem I have is that the click function gives the error "things_to_load.header_clicks[c] is not a function".

This makes sense as presumably the click function is saving the value and not what that value references.

how I can get this code to save the function not the string referencing it?

View 5 Replies View Related

Referencing Form In Variable?

Feb 10, 2009

i have a simple thing that causes me all sorts of headaches. I have many forms on the same page, and identical items in each form. The same object in each form call the same procedure. So, I'm passing in the form value, such as:

onchange="DoMyFunction('formName');"
and then in the procedure i do:
function DoMyFunction(formname){
document.[formname].object.value='1';
}

Now i have functions like this all over, problem is getting them to work. Once they work, they work fine. But when i add a new one, it can match an old function (except the object being referenced) and it won't work!

Does anyone know the proper way to reference a form in a function?

View 4 Replies View Related

OnMouseMove And Referencing A <div Id> Underneath Another <div Id>?

Sep 2, 2010

My functions for mouse_move / up / down all control the movement of a box. So you can click a box and move it anyway. It then snaps to an invisible grid. However there are multiple boxes on the screen so if you move it to a spot where another box already resides, then that box needs to swap places.This is what the mouse_over function tries to do. When I click the first box it stores the position of that box that was clicked. If I release the mouse button whilst hoovering over another box I want the other box to take the stored positions of the first box.However what I think is happening is the mouseover function is applying the new position to the box I'm moving, as I guess this is the first layer the mouse is over.Is there anyway I can reference the layer underneath using onmouseover.

<script language="javascript">
var x;
var y;

[code]....

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved