473,748 Members | 6,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript send

Dan
Hi,

Is there a way to send information via javascript by redirecting to a
page that contains frames? The information that will have to be sent
will be the page name of the original page before the redirect. Once
the information has been sent via the redirect this will happen: One
of the frames will pick up the sent information and redirect to the
proper page sent with the information. The object of this is to see if
a page is part of a parent page and then if it is not it will redirect
to the parent page, where one of the child pages will redirect to the
original page. So in summary, if a page is not part of a parent page,
the script will make it. If anyone else sees a better way to do this
please tell me.

<script type="text/javascript">
var o;
if ( (o = top)
&& (o = o.frames)
&& (o = o.bob)
&& (o = o.document)
&& (o = o.title)
&& o == "test"
){
document.write( "yes")
} else {
document.locati on.href = "New Text Document.php "
}
</script>

Dan

Dec 1 '05 #1
5 2786
Dan wrote:

..o( Dan, Dan, Dan ... I remember that name and subject. Ah, there: )

news:36******** ********@Pointe dEars.de
news:11******** ********@Pointe dEars.de

What part of it was unclear so that you posted the same bad stuff again?
PointedEars
Dec 1 '05 #2
Dan
I am sorry to cause you so much frustration because of me. :) What I
want is to find the url of the page using javascript (or php if it is
possible). This information will then have to be propagated through
the url. Then I want to make sure the information only goes once. For
example, since my end page will contain frames I need it to delete the
information out of the page once it is used. Is this possible?

Dec 3 '05 #3
Dan
Also, I would like to know how to use the information from the url.
Sorry for my ignorance :(

Dec 3 '05 #4
Dan wrote:
Also, I would like to know how to use the information from the url.
Sorry for my ignorance :(

You can send data to the following page by appending a '?' character
after the URL than your data, e.g.:

<a href="page2.htm l?hereIsTheSent Data"
alt="">Click to send data</a>

Then in page2.html you get the data by:

var sentData = location.search ;

and 'sendData' will contain the string '?hereIsTheSent Data'. Use a
substring or regular expression to trim the leading '?' and there's your
data.

You can prepare the string for safe transmission using encodeURI, then
get back the original string in page2.html using decodeURI.

a trivial example (in a page called say 'test.html'):

<a href="test.html " alt=""
onclick="modURI (this, prompt('Enter some text',''));"Click to send data</a>


<script type="text/javascript">

function modURI(a, txt){
if (window.encodeU RI){
a.href += encodeURI('?' + txt);
} else if (window.escape) {
a.href = '?' + escape(txt);
}
}

if (window.decodeU RI){
alert('The text you sent was'
+ decodeURI(locat ion.search).sub string(1));
} else if (window.unescap e){
alert('The text you sent was'
+ unescape(locati on.search).subs tring(1));
}

</script>

--
Rob
Dec 3 '05 #5
RobG wrote:
[...]

if (window.decodeU RI){
alert('The text you sent was'
+ decodeURI(locat ion.search).sub string(1));
} else if (window.unescap e){
alert('The text you sent was'
+ unescape(locati on.search).subs tring(1));
}


It will display a little neater if the following is used:

if (window.decodeU RI){
alert('The text you sent was:\n'
+ decodeURI(locat ion.search).sub string(1));
} else if (window.unescap e){
alert('The text you sent was:\n'
+ unescape(locati on.search).subs tring(1));
}
--
Rob
Dec 3 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2241
by: john | last post by:
I have 2 major issues currently with javascript. 1. Doesnt anybody do any server side javascript anymore. I cant find anything on the net about it. My major issue is with database connections and queries. How do I set up a connection and send a quiery. any how-tos, links, sample code, advice whatever. 2. i fave a form that is dynamicly creating elements and I am trying to pass it to a server side script. How do I do this. The number of...
19
6929
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
9
1908
by: paul | last post by:
Hi All, We have a small dilemma. We have the following page: http://giggsey.com/m00Cow.php (don't ask about the content) that we want to turn into an interactive application for some new intake students at our school. However - we want to have multiple client PCs running a web interface that will allow them to type in their name / a message, and then this message appears on the "scroller" page, which will be on a projector.
7
3228
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
9
8426
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
4
1994
by: wardy | last post by:
Hi all, Looking for a bit of help with this one...I have a situation where I need to be able to determine the control that initiated a form's submit action in client-side Javascript. I am currently calling a Javascript function on the client-click that returns true/false to control the submission of a product, but I am now trying to implement functionality to disable the buttons after the initial click, but continue with the submit...
9
77440
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6796
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.