473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Simple JavaScript

Hi,
I want to do this.

Expand|Select|Wrap|Line Numbers
  1. <a href="registration.aspx?returnUrl=<Current Page URL>">Registration</a>

I want to place current pages' url in query string. I m doing this :
Expand|Select|Wrap|Line Numbers
  1. <a href="registration.aspx?returnUrl=javascript:current();&sessionTimeout=25&cancelUrl=javascript:current();">Registration</a>
Current Function :
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     Function current(){
  3.         document.write (document.location.href); 
  4.     }
  5. </script>
Please guide me where i m wrong.

Thanx in advance!
Jun 30 '10 #1

✓ answered by Dormilich

Please guide me where i m wrong.
to be honest, pretty much everything.

if this page is created through ASP or any other server side programming language, use that to print the URL. otherwise you have to construct the URL by JavaScript (but not inline JavaScript).

Expand|Select|Wrap|Line Numbers
  1. function attachURL()
  2. {
  3.     this.href += "?returnUrl=" + encodeURIComponent(window.location.href); 
  4. }
Expand|Select|Wrap|Line Numbers
  1. <a id="register" href="registration.aspx">…</a>
Expand|Select|Wrap|Line Numbers
  1. var reg = document.getElementById("register");
  2. attachURL.call(reg);

1 1404
Dormilich
8,658 Expert Mod 8TB
Please guide me where i m wrong.
to be honest, pretty much everything.

if this page is created through ASP or any other server side programming language, use that to print the URL. otherwise you have to construct the URL by JavaScript (but not inline JavaScript).

Expand|Select|Wrap|Line Numbers
  1. function attachURL()
  2. {
  3.     this.href += "?returnUrl=" + encodeURIComponent(window.location.href); 
  4. }
Expand|Select|Wrap|Line Numbers
  1. <a id="register" href="registration.aspx">…</a>
Expand|Select|Wrap|Line Numbers
  1. var reg = document.getElementById("register");
  2. attachURL.call(reg);
Jul 1 '10 #2

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

Similar topics

2
by: OM | last post by:
I need a simple Javascript shopping cart. I did a few searches on Yahoo... And got a few results of free Javascript shopping carts. The problem is there tooo complicated and very hard to...
1
by: minstrel80232 | last post by:
Hi Everybody - I'm new to this group - I need a little help please, I am looking for a simple Javascript form I can use to sign people up for classes on a web site. I have never done a form...
4
by: Owen Parker | last post by:
Hi all I am not a java programmer but i can hack at it a bit. I am trying to allow a user to define the text in a simple javascript text scroller. The data is stored as multiple records in a...
2
by: not | last post by:
Hello All, I am trying to develop a relatively simple self-quiz form in javascript, but I'm having no luck getting it to work. What I am looking for is a script that allow the user to select...
9
by: Astra | last post by:
Hi everybody Wonder if you could help me out. I created a simple JavaScript routine to enable a user to click backwards and forwards between small news articles. This routine works fine in IE...
2
by: Evan | last post by:
Hey, I posted this yesterday, but no one had any ideas? C'mon now, I know this isn't that hard, i'm just a little new to javascript, and I can't quite figure this out. I searched and searched to...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
4
by: Timmah1980 | last post by:
I'm sure this is a simple enough fix for someone out there, but I'm afraid it's beyond me! I'm putting together this simple menu for a client: http://www.timkeay.co.uk/mpc2/index.htm It...
2
by: babu07 | last post by:
I have a notebook with windows xp professional edition operating system. I tried did a simple javascript program, saved it in my document as .html. It did not work. Then I saved it in the root...
2
by: Yi | last post by:
I want to make a simple javascript widget, something looks like the Google AdWords, that people can just post a small section of code on their web page and display some content from my website. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.