473,473 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Javascript Keep data form after reload

23 New Member
Hello:

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.

<head>

<SCRIPT Language="JavaScript">
<!--

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

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

//-->
</SCRIPT>
</head>

<BODY>


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

</BODY>


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 9216
ronverdonk
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
nkoriginal
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.
Here:

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
Niko
Nov 14 '06 #3
pronerd
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

10
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.