To read a cookie:
Code:
<script language=javascript>
<!--
var cook=document.cookie.split(";");
var pieces=cook[0].split("=");
document.writeln("Your javascript cookie is called: " + pieces[0] + "<br>");
document.writeln("Its value is: " + pieces[1]);
I have been using document.cookie to write and read cookies. Unfortunately, when I open my page in Internet Explorer, I don't see what I wrote to my cookie while in Netscape Navigator. Similarly, my page that I opened in Netscape doesn't see what I wrote to the cookie while in IE.
Surely there must be away for IE and Netscape to read the same cookie information ??. Otherwise, what happens if a user just happens to be browsing my page in both browsers? They'll expect things to be there, and they won't be there because one browser doesn't see what was written in the other.
Any ideas on how to get Netscape to read cookies written by IE, and visa versa?
yourdrive E ~~local~~/ 1088 647360864 29848791 647360864 29848791 * maindrive C ~~local~~/ 1088 647360864 29848791 647360864 29848791 *
So they must be being set. I must have tried a dozen cookie reading routines and I can't read either of them back! Can anyone do it? I am sure it must be simple. But all I get is "false" all the time. Code:
I'm not to good at javascript. I know VB.net, but I have not learned javascript yet. I am working on a project to get a survey to pop up for new visitors on the index page of our site.
What I need to do: On load look for a cookie, if that cookie is not found run a script telling the site to pull up another page in lightview [URL] using its own "on load" command. If the cookie is there the site will not open this other page.
What I've done: I already found a way to do most of this, but I can only use a hyper link as a trigger for the site to load the other page in lightview.
Now, I am not talking about some kind of malicious coding, or spyware writing by any means, but I do need it to be able to read the cookies from a site other than my own. At least I think this is what is required. What I am trying to accomplish is this; I have a stats package setup on a different domain than my live website and I am using it to track the stats of the users on my site other than paying for stats service through some other company, and it seems to be working just as I need it to, only I would like for it to be able to do a little bit more. Right now, all it is capturing form the user is their IP address, browser information and host information on their ISP. But, I would like for it to be able do more. I would like for it to be able to retrieve certain cookies generated by a different site and show me the information in which the cookies hold... I am not talking about displaying passwords or any such thing like that, I just need certain information.
So I need to make a webshop for a school project.I wrote the javascript for my shopping cart page.I made an object Artikel and an object ArtikelList which contains an array of Artikel objects. Then I save the ArtikelList object into a cookie.But when I try to read the data from the cookie again I can't get it to work.Let me know if you need more info/details.Links with the javascript: [JavaScript] artikelToevoegenAanWinkelkarretje.js - Pastebin.com[JavaScript] winkelkarretjeInlezen.js - Pastebin.com
So. I've been working on this stylesheet switcher for a school project, and basicly there are 3 layouts, "Standaard", "Zwart-wit" and "Printversie". What I want is that when you select one on (for example) the homepage, I want the other pages to apply the same stylesheet. I've been trying to do that with cookies, but it doesn't even work on one page.
PHP Code: function setup() { var current_style = read_cookie();
I've looked on several websites and several threads here regarding writing and reading cookies with javascript, and I just can't seem to get it to work. All I want is a simple text box with 2 buttons: Save and Recall. Text entered into box is saved to a cookie when "Save" is pressed, and at a later date when "Recall" is pressed the saved text will show up in the box.
Is there a way to use Javascript to read a txt file, take all the words in the txt file one by one, then create a cookie out of each of them? Ideally, I'm also looking to create a prompt which asks the user if they want to set the cookie each time.The purpose of this is that I'm looking to create some basic browser based games (with information stored in txt files), so it doesn't have to be a script which works online. Everything is just run offline. If it makes a difference, it can also be, say, a doc file rather than a txt.I understand the idea of using activeX & IE to read the txt file, and after looking through this forum, I have found a way to load the entire txt into a form. I have not been able to advance my idea beyond that however.I've used Javascript before many times for webpages, but it generally comes down to me copying and pasting code, then just changing a few keys words. What I'm quickly trying to say there is that I can use js, but I'm not that much of an expert.
I'm trying to create a simple checkout system that utilizes cookies to pass information from page to page. Currently, my entire script works fine except for the read cookie portion. I cannot figure out what is wrong with it. It has been validated and the syntax is fine; it just doesn't work. I use the function with the onload call on my html file such as:
I'm an ASP developer by trade, but I've had to create client side scripts with JavaScript many times in the past. Simple things, like validating form elements and such.
Now I've been assigned the task of extracting content from a given HTML page. If anyone's familiar with the Yahoo! Store order confirmation screen, I need to be able to grab the total amount from the table to the right-hand side. (Sample File: http://www.2beyourself.com/t/sample.html)
If you view the source, this is in a table and enclosed with ugly html. the value I want to retrieve is wrapped with b tags. Originally I was thinking of using innerHTML or innerText for extracting the value. But I find that we cannot gain control of this piece of the Yahoo! Store to make it work!
So after talking with peers, we thought of reading in the entire HTML page and using regular expressions to try and extract the value. Something along the lines of: '<b>[0-9]+.[0-9]{2}</b/>'
I'm not sure how to accomplish this. Could someone please point me in the right direction? If this solution is even a good one. If you have something better, I'm all ears! (eyes) If using the regular expression would be a good solution, I need to find out how to read in the entire HTML doc, and then parse out that piece.
I just need someone to tell me what the proper syntax is for calling a perl sub from another perl sub.. in trying to use onClick to call a sub in Htmlform() .. but its not working... the cgi works fine.. the mySql parts work fine.. more specificallyprint start_html(-title=>'Lab 6',-scrip=>{-language=>'PerlScript', src=>'mySqlProg.cgi'});i dont know if the above is the corect syntax in relation to thisprint "<button type='button' value='view' onclick='show_entries();'>Show Table Values</button>";
#!/usr/bin/perl use strict; use warnings; use CGI qw/:all/;
I have a problem with my perl program - it is not able to display the output of vowel count and word repetition count from a text file. The whole Perl program is supposed to read a paragraph of text and calculate followings based on the text:
1. number of empty spaces. 2. number of words in the text. 3. number of vowels in the text (a,e,i,o,u) 4. number of words with repetition in the text
Example output:- No. of empty spaces: XX No. of words : XX No. of vowels - a:: XX e: XX I: XX o: XX u: XX Words with repetition- Word 1 : XX Word 2 : XX ..... .... ..... ....
The Perl writes an application/x-javascript header followed by some js code (like document.write).
I can't use the hidden frame method suggested by Erwin Moller because the client page is an eBay ad, and they will not allow any frame code.
Now I want to pass to my Perl script an argument value which cannot be known until the page is loading (specifically, the page title, which is created by eBay and contains a unique id). I know how to get the page title with js, but there's no way (that I can figure out) to dynamically create the src argument of the <script> tag.
I've uploaded a new version of the javascript::Minifier module that was on CPAN. It was a translation of JSMin but I rewrote it so it now handles missing semicolons, + ++ code, and leaves those freaky IE conditional comments in the output. The goal was that if working code is input then working code is output where working == working. Breaking code that works is not such a good idea. Code:
I want to check whether the flash is installed or not on client so i have a javascript function which does this , now i want the resultant variable from this function to return to perl variable in cgi file. i dont want to use form submit because i dont need it. i simply have to take decision for further coding depending on this variable returned from javascript. :cry:the way i m doing is,cgi file,
I have a webpage (Perl) that allows a user to select one of two buttons that represent :
<button id = "1" onclick="loadXMLDoc('mysqlinsert.pl')">Choose $name1</button> <button id = "2" onclick="loadXMLDoc('mysqlinsert.pl')">Choose $name2</button>
Based on the button they choose, I need to pass a variable (declared in Perl) to another Perl page that is responsible for updating/inserting in a MySql Database.
As you can probably tell, I'm new to this. But I'm not sure how the variable ($name1) can be used in Perl to the loadXMLDoc, and then get passed using the 'POST' technique to mysqlinsert.pl??
function loadXMLDoc(url) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
I have posted a question I believe that relates more to the PERL language, but it has to do with reading an external data only javascript extension file. [URL]
I am asked to use JavaScript as part of an intro course on Perl in one of the projects.There are two html frames. The lower frame contains two user forms, one for a set of fields (name, email, comments etc), and the other that I am trying to add so that I can set a refresh rate for the upper frame.When I submit the frame rate as a number, say 5, the upper frame reloads but does not refresh at the rate I indicate.
I am making a call to a perl script using AJAX, this is basically updating a shopping cart item quantity, however; it only works about half the time.. Code:
function UpdateItem(Qty, ProdID, Size){ var XMLHttp; var ee; if(navigator.appName == "Microsoft Internet Explorer") { XMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { XMLHttp = new XMLHttpRequest(); } [Code]...
I have a perl script which is called via Ajax. It simply writes 3 values to a database. The code works fine (values get written successfully) but I get an "Internal Server Error" thrown. The Errorlog says "premature end of script headers". There was no problem with the application - it works as required and has for a few months - but I noticed the error via Firebug when testing something else.So I started stripping perl out of the script in an attempt to locate the problem .. and continued till I only had only had two lines left .. the shebang and exit .. I still get the 500 error. Running the script direct from a browser gives the 500 error in the browser window ... from the command prompt it's fine - ie. nothing in the apache errorlog.
There is nothing wrong with the server configuration - it has hundreds of perl scripts and has been running for years.
Looking to parse the XML file a perl script sends back.I wantto get values from specific tags in the XML file. Here is my code:
[Code]...
The code seems to be getting hung up on the dataType: "xml", line because when I comment it out, it goes to the next step and executes the function (although it doesn't do anything). how I can change this or just take a different approach? Let me know if I can provide more information.
I'm finally diving into regexp by porting a perl script over to js that uses regexp to compress javascript into a bookmarklet capable format.I've successfully worked out 90% of the expressions but am troubled with a few, this one at the moment is odd:I want to remove the first line if it hasjavascript:So I thought str.replace(/^javascripts+:s+/, "") would be ok. I want javascript text, any space, colon, any space and new line. what I'm doing wrong.btw this is the original perl version