Jump to content

[SOLVED] I'm new to JavaScript so be nice. Not working Link.


paulman888888

Recommended Posts

I am a happy at PHP but i wanted to start learning JavaScript so after reading off w3 i started to make a link using a form.

 

here is what is out puted after PHP.

I decide not to show you the PHP incase you dont do it.

Heres the javascript line

<a href="#" onclick="window.location.href='?page=Packages&id'+Form.request.package;"> View Package Details </a>

What i tryed doing is making JavaScript Take the user to a new page but useing a bit of information selected by the user from a drop down menu form.

 

<form id="request" method="POST" action="index.php?page=Request"><br />
<input id="name" style='width:70%;' name="name"  type="text" maxlength="50" value="Name" /><br />
<input id="email" style='width:70%;' name="email"  type="text" maxlength="250" value="Email Address" /><br /><select name="package"><option value="  ">Guru</option><option value="  ">Starter</option><option value="  ">Advance</option><option value="  ">Master</option><option value="  ">Basic</option></select><a href="#" onclick="window.location.href='?page=Packages&id'+Form.request.package;"> View Package Details </a><br /><textarea id="msg" style='width:90%; height:200px' name="msg">Please Enter Your Plan Here Including what feature you want, like; Guessbooks, Forums, Upload area, Members area and ect.</textarea><br />

<input id="Submit" type="submit" name="Submit" value="Submit" /></form>

 

Please help me my this link work.

 

Thankyou for any help

Paul

Link to comment
Share on other sites

Thankyou for the help but it still is not working.

 

Heres the firefox error console;

Error: Document.Form is undefined
Source File: http://testing.hidden address.com/index.php?page=Request#
Line: 1

 

Heres the update javascript code with PHP removed.

<a onclick="window.location.href='index.php?page=Packages&id='+Document.Form.request.package.value;" href="#"> View Package Details </a>

Link to comment
Share on other sites

Thankyou all again.

 

With your help i fixed it.

<a onclick="window.location.href='index.php?page=Packages&id='+request.package.selectedIndex;" href="#"> View Package Details </a>

 

The reason it didn't work was because i used .value a the end but its not a text field so it didn't work. i had to use .selectedIndex and remove the stuff before. it

 

Thankyou again

Paul

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.