This is a discussion on Javascript Help within the Coding Help forums, part of the Webmaster Help category; Lads again my JS knowledge is letting me down in AJAX. My ajax is returning the code Code: addPubNum( 5940, ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||||
| Lads again my JS knowledge is letting me down in AJAX. My ajax is returning the code Code: addPubNum( 5940, '1796 Wolfe Tone Bar' , 'pubid1' ); Code: function addPubNum( id, name, pubnum ) {document.forms['addpub'].elements[ pubnum ][ document.forms['addpub'].elements[ pubnum].length ] = new Option( name, id );}
Code: <table width="100%"> <form name="addpub" action="userpage.php" method="GET">
<tr><td colspan="2">Please Enter Your 1st Pub</td></tr>
<tr><td><select name="countyid" onChange="showPubNum(1,this.value);"><option value="0">Select County</option>
<option value="1">Antrim</option>
<option value="2">Armagh</option>
</select></td>
<td><select name="pubid1"><option value=""></option></select> </td></tr>
<tr><td colspan="2" align="right"><input type="submit" value="Add"></td></tr>
</form></table>
If anyone could see an error off the top of their head that would be great! P.S. -> showPubNum(1,this.value); is working fine! |
| |||||
| where is this element on your form? pubnum
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| |||||
| I am using pubnum as a variable (Sorry about my naming schemes it was late last night doing this one) basically I want to take a variable into the function to select which element to change. in this case I want to change pubid1 so I take in variable pubid1. |
| |||||
| I need more info and code... |
| |||||
| Sorry Louie and thanks for your time The page can be found here: Find and Rate Pubs in Ireland the ajax is ran when you select a county. |
| |||||
| garry you are all over the place with that AJAX code. What are you trying to do? Push options into the select menu or replace the select menu with a new one? |
| |||||
| How do you mean all over the place? I run the ajax on a select, this pushes to the ajax.php which returns a set of javascript commands which I run to populate the options? |
| |||||
| try this solution: PHP Code: |
| |||||
| You got it.. cool |
| Tags |
| javascript |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Javascript loop | louie | Coding Help | 13 | 01-02-2008 09:27 PM |
| Javascript problem | ph3n0m | Coding Help | 1 | 21-06-2007 03:57 PM |
| javascript | 7aken | Coding Help | 1 | 03-04-2007 03:50 PM |
| javascript help | 7aken | Coding Help | 2 | 20-02-2007 06:09 AM |
| Javascript/CSS menu help? | ButtermilkJack | Coding Help | 4 | 16-04-2006 05:59 PM |
| ||||||||
| | ![]() | |||||||