I'm working on an internal website at work and employees have a cookie created when they login to the customer support tool. The filename is cookie:username@domain.com/ and I'd like to use javascript to pull a variable for their username to plug into a URL for a unique link when they're viewing one of our intranet pages.
@domain.com/ will always be the same but I don't know how to pull the unique username from the filename of the cookie. I don't need to actually read the cookie.
Is there a way to set the cookie filename with JS?
Currently it is setting it as 'asp/' (my directory). Can i specify it? This is my code:
function setCookie(NameOfCookie, value, expiredays) { // Three variables are used to set the new cookie. // The name of the cookie, the value to be stored, // and finally the number of days until the cookie expires. // The first lines in the function convert // the number of days to a valid date.
var ExpireDate = new Date (); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
// The next line stores the cookie, simply by assigning // the values to the "document.cookie" object. // Note the date is converted to Greenwich Mean time using // the "toGMTstring()" function.
We need to find a way to pull a user's NT ID (Windows log on), and store it in a variable for use later on, and also to watermark the screen on HTML pages in an eLearning course. I have no idea how to do this and I can't seem to find anyone who has encountered a need for this.
I have an external javascript sheet with an array of images w/text and the following code:
var current = 0; function update() { var pic = slides[current];[code]....
When the user clicks the link, it should open the page to the slideshow and it should start on slide[8]. I think what I need to do is pass the value of the cookie to the variable "current", but I don't know how to do that. Also, I only need the cookie to last long enough for the new page to load (about 20 seconds), but all of the cookie scripts I've found set expiration in days.
We are using a cookie (written in javascript and url encoded and decoded) to store form variables so that when the page is reloaded we can keep the form variables. We are having a problem with the email address field - the cookie only returns the email address up to the @ symbol and we have narrowed it down to the regexp function....
I'm more of an actionscript person but got roped into an html/javascript job.What I need to do, and it shouldn't be that difficult is this:page1.html - there is a yellow button and a red button - if the user clicks on the yellow button I want to set a cookie with the value "yel" then load the next page - if they click the red button set that cookie with the value "red"page2.html - 'onload' i want to read that cookie and load up the main image to match, something like this maybe?... document.mainimage.src='img/main_' + variable + '.png'so that the path would be for example 'img/main_red.png'f you think this would be easier sending that variable in the URL instead of as a cookie please explain. I'm having a very hard time searching for tutorials that are any good and that do exactly this kind of thing.
I'm using a geolocator service to find the zipcode of a web page visitor using the code below. This will be used to serve up ads to the visitor based on their zip code. The question is, how do I pass the zip code value from the script into an ASP variable, such as a cookie or session object?
Can I make a list of hyperlinks that users can customize and save as a cookie by clicking a button and automatically retrieve the cookie so it remembers their list next time? This is kind of what I want to do:
I am making a sort of text based game (Just a hobby) I like to do that sort of thing. So, anyway, considering all I can really do is code HTML, and very, very light javascript, I kinda need some help.
I basicly know how to do everything except affect & Use the cookies. So what I need to do with them is to
#1.) Have a code to change the cookie number, say... on the click of a button.
#2.) Have a code where it only displays certain text if the cookie is a certain number.
I cant code JS and have no idea how hard/easy this is.
If it is insanely hard & needs a master coder, just tell me and ill take it off. I dont want to be wasting anyones time.
<script type="text/vbscript"> Dim objWord Sub Btn1_onclick() call OpenDoc("K:DeloitteTeam1 Status reportJavaProgramshi.txt") End Sub
Sub OpenDoc(strLocation)
Set objWord = CreateObject("Word.Application") objWord.Visible = true objWord.Documents.Open strLocation End Sub </script>
I would like to pass the filename used above in the button code below so the above code could be coded only once and then mutiple button code could be used.
Can I subtract the filename form the location.pathname ex: Before = 'file:///c:/afolder/awebsite.html' After = 'file:///c:/afolder/' Or is there any other way to get the directory without the name of the file being veiwed?
I have an embedded system with a web interface. One of the web pages has a small JavaScript program that, when run on IE6, always displays the message that cookies need to be enabled:
if (document.cookie.indexOf('asm_session') == -1) { document.cookie = 'asm_session=0' if (document.cookie.indexOf('asm_session') == -1) { document.write("Advanced System Management access requires cookies to be enabled."+'<br><br>'); } }
This problem only occurs with IE6, not Mozilla. It also only happens on some of the embedded systems, but this problem exists for everyone running IE6.
The problem isn't limited to the Javascript code, either. On another web page from this embedded system, a cookie is set the normal way, via the HTTP header. This cookie is also rejected.
When I display any page that attempts to set a cookie, IE6 displays the blocked icon and says that cookies on that URL are blocked. However, I have set all privacy and cookie options to their most permissive. I've spent the past hour changing every option I can find that's even remotely related to cookies and privacy, and nothing changes. Does anyone have any idea what's going on?
In my web application we are able to store large data in the browser cookie keeping in mind the limit of 300 cookies per cookie file, 20 keys per cookie per domain and 4KB max size of each cookie. We are unable to retreive this large amount of data immediately after storing through document.cookie in IE browser (The same works fine in Netscape).
Is there any limit on the size of the data that can be retreived using document.cookie in IE browser? Could you please suggest a solution to this problem I am facing.
This is a simple script I though of to get the filename of container for html.
Note: this only is tested on mozilla firefox 2 on windows vista
document.write("<a style='display:none' id='zFilenameFinder1' href=''>q</a>"); document.write("<a style='display:none' id='zFilenameFinder2' href='b'>q</a>"); var zDocURL = document.getElementById('zFilenameFinder1').href; var zCompareURL = document.getElementById('zFilenameFinder2').href; zCompareURL = zCompareURL.replace('b',''); var zFilename = zDocURL.replace(zCompareURL, ''); alert(zFilename)//filename handler
it works by creating two relative urls. one's href is blank, which when called by link.href returns the absolute value, giving the absolute link the page, then you compare it to a link that has a relative href of "b" which can be compared to the other link to give you the whole url
I have recently come across the need for using the name of the image file within js, but I can't locate it. I am well versed in php, but my js skills are noticeably weak. About 25% of the way into the (partial) lightwindow.js I have placed a comment that shows where I need to access the current image filename.
Code:
This will stop image flickering in IE6 when elements with images are moved try
I'm trying to figure out a way to pass the filename before submission... I think I have to make an onChange command on the file field, but not sure how...
This is what I have done so far: <script type="text/javascript"> function theimage(){ var imgURL = document.getElementById('myfile').value; ste.execCommand("insertimage", imgURL); } </script>
I'm using Joomla. I've got a dropdown which reads the filename from the database. When the user selects it I want an onchange event to open the pdf.I've been at it for 2 days now.
<?php $con = mysql_connect('localhost', 'root', ''); if (!$con)
how to save form values in cookies, etc. for use when re-displaying the forms. for example, after an error has been detected. Naturally, PHP allows you to do this with $_SESSION variables.
But no one seems to have cracked the problem with FORMs having file uploads. Browsers will send the file to the server and the name, but not the path on the client computer (I suppose for security reasons).
So, if you want to re-display the page, you can fill in all the form data in your PHP script so that the user doesn't have to re-enter everything. But, since your PHP script only knows the NAME of the uploaded file, and not the path, whatever your fill in for the "xxx" in <input type="file" value="xxx" /> will be wrong.
I have a webform that creates a word document as it's ouput (yes I know it only works on IE). function createWordDoc(){ Doctxt = "some text here" var w=new ActiveXObject("Word.Application"); w.Visible=true; w.Documents.Add(); w.Selection.Font.Name="Times New Roman"; w.Selection.ParagraphFormat.Alignment = 1; w.Selection.TypeText(Doctxt); w.Documents.Save(); }
My issue is with saving the file. At the moment, in the above code, it opens the save dialogue box, and populates the filename field with the first line of text in the document. What I want to be able to do is populate the filename field with a variable filename created by the function. I've tried the snippet below, which works with the dynamic filename, but it autosaves the file to "My Documents" folder without prompting. I need to be able to allow the location to be changed. var FileName = "Myfile.doc" w.ActiveDocument.SaveAs(FileName);
I am new to this forum, so your help would be most appreciated.
I am trying to create a javascript where, on clicking a button, I will be able to download the latest log file. But the log filename changes everyday as it takes the current date as part of the filename. eg. EMEA_20070806 i.e. EMEA_yyyymmdd Also, the previous day's log file is stored in the same directory.
How can I create a button where it will download the latest log file at all times?
I am using the "Validation" plugin to validate my form. This is a multipart form where a user can upload a file. I would like to validate the choosen file name such that it contains only alphanumeric characters plus defined extensions. For that I tried the combination of the rules "accept" and "alphanumeric" but this does not work because the file name is the full path of the file name and it contains non alphanumeric characters as: C:umyDirectorymyFile.txt
regular expression which could tests that myFile is made only of alphanumeric characters ?
I need to put previous/next navigation button images on a lot of slides.If i am on slide 3 I'd like javascript to identify previous button as slide2.html and next button as slide4.html and so on