473,574 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Keep data form after reload

23 New Member

I tried an script for keep my data form after reload page, but I've some errors.
In this momento I runnung my own browser because we've an intranet. And for security reason, our page reload every 10 minutes for keep my login live.
But, we've some forms, and 10 minutes is a shorcut time to do that, and very 10 minutos, our page reload, and we lose all data in form (before submit).
So, for that reason , I want to keep my data after reload, but clear after submit.

My problem right now is, I've a javascript, keep my data, BUT every time I access to that page appear an syntax error.


<SCRIPT Language="JavaS cript">

var url_str = window.location .toString();
var url_split = url_str.split(' ?');

var var_split = url_split[1].split('&');
x = 0;
i = 0;
while (i < var_split.lengt h)
curr_val = var_split[i].split('=');
document.form1[x].value = curr_val[1];
x = x+1;
i = i+1;



<FORM Name="form1" Method="get" Action="example .html">
<INPUT Type="text" Name="1">
<INPUT Type="text" Name="2">
<INPUT Type="submit" Value="Post">
Once you have completed the form to save click post then bookmark this page.


The error appear in
Line: 11
char: 1
error: syntax error
code: 0

Somebody knows what happen with this script?

Thank you for your help
Nov 14 '06 #1
3 9233
4,258 Recognized Expert Specialist
Do you want me to guess what it could be?? What is line 11?

Ronald :cool:
Nov 14 '06 #2
23 New Member
Do you want me to guess what it could be?? What is line 11?

Ronald :cool:
hahahaha. Im sorry Ronald. Is my fault!

the line 11 is the else.

var var_split = url_split[1].split('&');

That "else" show me error in explorer and I dont know why.
I really appreciate your help.
Thank you
Nov 14 '06 #3
392 Recognized Expert Contributor
Is there more to the script than is shown? The else needs to have an If before it, and I see two opening braces, but three closing ones.

Assuming that there is an if statement that is just now shown, and assuming that there is only one "?" to split on then the array pointer should be 0 not 1. The first value in arrays is zero.
Nov 14 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on search.php, data is received and stored in variables within results.php, MySQL structure seems to work as expected, although i get some problems: As soon as i click on the "Page 2" Link, i get...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.