Passing Variables With Javascript

passing variables to page without form

Page 1 of 1

3 Replies - 2076 Views - Last Post: 21 May 2003 - 12:29 PM

#1 poab  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 26-June 02

Passing Variables With Javascript

Posted 20 May 2003 - 02:40 AM

Hi,

I haven't got much javascript development experience but I think it's probably the best solution to this: What I need to do is pass a variable to a page when clicking on a link. At least I think that's what I want. One major facotr is I'm not allowed beyond 1.0 (unless there is no other solution). What I've got so far is this:

<!--html form--><form name="one" action="myPage.asp" method="post"><input name="oneval" type="hidden" value="open" /></form>
<!--link with javascript--><a href="javascript:document.one.submit">link text</a>


That works spectacularly fine. The link sits in the page the form is invisible, click the link and it passes the hidden input's value to the asp page. All lovely, but with two problems:

1) Everytime a user clicks the link they get the 'Do you want to submit this form unencrypted across the internet" warning pop-up (unless they've disabled it). - which doesn't exactly inspire confidence.
2) Not very elegant is it?

So, anyway to get the same result but bypass the form? Any help much appreciated.

cheers.

Is This A Good Question/Topic? 0
  • +

Replies To: Passing Variables With Javascript

#2 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Passing Variables With Javascript

Posted 20 May 2003 - 05:02 AM

Does the method need to be POST?
Was This Post Helpful? 0
  • +
  • -

#3 gneato  Icon User is offline

  • <title>Untitled Document</title>

Reputation: 0
  • View blog
  • Posts: 1,311
  • Joined: 03-September 01

Re: Passing Variables With Javascript

Posted 20 May 2003 - 10:32 AM

If you can deal with a "GET" method, then just form the link like this...

<a href="myPage.asp?oneval=open">link text</a>
Was This Post Helpful? 0
  • +
  • -

#4 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Passing Variables With Javascript

Posted 21 May 2003 - 12:29 PM

<a href="myPage.asp?oneval=open">link text</a>

That will work right?
If not, then I don't really understand the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1