mytwocents All American 20654 Posts user info edit post |
I know what javascript is...so I know that you don't have to download anything in order to make it work on a webpage (besides having the obvious script) so I'm really confused as to what ajax is and how to use it? Is there a whole 'library' you have to download and THEN reference it with a script on a page? I've come across something called jQuery....is this, for all intents and purposes, a 'competitor' to ajax? Used the same way? Different way??
I am attempting to make a form that dending on a radio button choice, greys out/removes a following paragraph...which the hell do I use? Which is better? 3/1/2008 5:28:09 PM |
BigMan157 no u 103354 Posts user info edit post |
jquery is a javascript framework, like mootools and prototype
ajax is a way of using javascript to send query strings to files and read in file contents dynamically, without having to submit the page
jquery might contain an ajax class, to make an ajax function simpler to code but you don't need anything special to execute an ajax function
for what you are doing, you more than likely don't even need ajax 3/1/2008 5:57:08 PM |
mytwocents All American 20654 Posts user info edit post |
what would I need for the bare minimum to do this? I basically have a registration page where there is a question: Do you need a visa? If yes, then a bunch of questions about it either load (or just remain on the page) and if no, then those questions either don't load, (or fade/disappear from page)? 3/1/2008 6:01:21 PM |
BigMan157 no u 103354 Posts user info edit post |
<script language='JavaScript' type='text/javascript'> function tog(state) { if(state) document.getElementById('other_crap_that_may_dissappear').style.display=""; else document.getElementById('other_crap_that_may_dissappear').style.display="none"; } </script>
<input type="radio" name="loller" id="yes" onclick="tog(1)" /> <input type="radio" name="loller" id="no" onclick="tog(0)" />
<div id="other_crap_that_may_dissappear">blah</div>
at it's most basic level
[Edited on March 1, 2008 at 6:11 PM. Reason : not ==, =]3/1/2008 6:10:29 PM |
robster All American 3545 Posts user info edit post |
Yeah, dont really need ajax for this, BUT, you CAN use AJAX for this ... just depends on how much work you want to do. 3/1/2008 6:23:24 PM |
mytwocents All American 20654 Posts user info edit post |
NEVER MIND>>>I GOT IT WORKING
OMG I LOVE YOU BIGMAN
[Edited on March 1, 2008 at 6:31 PM. Reason : ] 3/1/2008 6:30:34 PM |
mytwocents All American 20654 Posts user info edit post |
hrmf.....is there any reason why the placement of the div is causing the script not to work? Its really odd but if I put the question and the div at the top of the page, it 'seems' to work....but otherwise it's not...and now it's all fucked up.....Here's what I've basically got:
[Edited on March 1, 2008 at 8:33 PM. Reason : kjdnvk.ndvk .j˜ßc ] 3/1/2008 8:29:45 PM |
moron All American 34144 Posts user info edit post |
this page is completely borked 3/1/2008 8:30:53 PM |
mytwocents All American 20654 Posts user info edit post |
since It's not working CHECK THE EDIT POST FOR THE CODE
] 3/1/2008 8:34:26 PM |
moron All American 34144 Posts user info edit post |
don't we have a code /code tag here?
<script language="JavaScript" type="text/javascript">
function tog(state) {
if(state) document.getElementById('other_crap_that_may_dissappear').style.display="";
else document.getElementById('other_crap_that_may_dissappear').style.display="none";
}
</script>
<tr> <td>Do you need a US visa? <input type="radio" name="loller" id="yes" onclick="tog(1)" /> <input type="radio" name="loller" id="no" onclick="tog(0)" /></td> </tr>
<div id="other_crap_that_may_dissappear">
<tr> <td>What do you need? <input type="radio" name="need" value="1">Original (only select if REQUIRED) <input type="radio" name="need" value="2">copy via e-mail <br><br> <input type="radio" name="need" value="3">Faxed copy <br><br></td> </tr>
<tr>
<td>What needs to be sent to you directly?? <input type="radio" name="sent" value="1">Original (only select if REQUIRED) <input type="radio" name="sent" value="2">copy via e-mail <br><br> <input type="radio" name="sent" value="3">Faxed copy <br><br></td>
</tr>
</div>
[Edited on March 1, 2008 at 8:41 PM. Reason : ]3/1/2008 8:40:37 PM |
moron All American 34144 Posts user info edit post |
And i'm not an HTML/javascript expert or anything, but maybe you need to have default to tog(0) so it's initially blank. 3/1/2008 8:44:00 PM |
BigMan157 no u 103354 Posts user info edit post |
you're wrapping table rows in divs, that's probably causing something to go kablooey 3/1/2008 9:03:43 PM |
mytwocents All American 20654 Posts user info edit post |
Gdamn BigMan.......you ARE THE SHIT.
Seriously. You r0x0r
I swear it.......my top l33ts on here:
BigMan157 qntmfred evan Noen
3/1/2008 9:10:42 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
i'll make the list after i get my huge bump on my face cut open and video it for you haha 3/1/2008 10:08:04 PM |
Golovko All American 27023 Posts user info edit post |
Quote : | "I am attempting to make a form that dending on a radio button choice, greys out/removes a following paragraph...which the hell do I use? Which is better?" |
just use javascript and use the document.getElementByID();
on the radio button when its clicked call the javascript function that either hides or shows each paragraph of text. Its really simple to do and does not require AJAX. AJAX would only be needed if you were sending and receiving data to a database and had to update it to the page without actually submitting the form.3/2/2008 12:23:08 PM |