addtrain Posted September 9, 2007 Share Posted September 9, 2007 ok... i think that this is probably very advanced, since even a college computer admin couldn't get how you can do this. there is tons of pages out there that do this. if you wanna see an example, go to either http://joeyxchaos.com/train/1.php or http://addsx.com/, and click add to friends. once the window comes up, close that popup window. it should go to myspace.com. then, look at what has happened to the "Not Added" text. it has changed to "added!". i took a look at both pages scripts, and style sheets, but i couldnt find out where the changing of the text happens! i did "view source" on the part BEFORE i clicked "add me!", and the part AFTER i clicked it, and the code is BASIC HTML, yet it changed after i clicked it. the college computer admin says that whoever makes these, that the code simply changes. i want my site to be able to do the same thing. how do i do this? is it possible (it must be since i have proof)??- seamus stumped ??? Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 9, 2007 Share Posted September 9, 2007 Well, at first reading of your post I thought the sites might be using AJAX (a combination of Javascript and a sever-side platform such as PHP). But after looking at your "examples" it seems they aren't using AJAX at, just a simple javascript even to determine that you have clicked the link. Here si a simple example: <html> <head> <script type="text/javascript"> oldTextAry = new Array(); function changeText (fieldObj, newTexStr) { fieldObj.innerHTML = newTexStr; } </script> </head> <body> <a href="http://www.yahoo.com" target="_blank" onclick="changeText(this,'Added');" id="text1link">Add Me</a> </body> </html> Quote Link to comment Share on other sites More sharing options...
addtrain Posted September 30, 2007 Author Share Posted September 30, 2007 thanks, ill try this... Quote Link to comment Share on other sites More sharing options...
addtrain Posted September 30, 2007 Author Share Posted September 30, 2007 hmmm...this acualy didnt work Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 30, 2007 Share Posted September 30, 2007 hmmm...this acualy didnt work Well, that doesn't help. Are you getting errors? If so, waht are they? How, exactly, does it not work. The example I posted above works for me just like the sites you gave as an example. Quote Link to comment Share on other sites More sharing options...
addtrain Posted September 30, 2007 Author Share Posted September 30, 2007 well, my file is named lolz.php... maybe it should be html? when i click on the pic, the text wont change. id like it to be like addsx.com, and change after you click it. Quote Link to comment Share on other sites More sharing options...
addtrain Posted September 30, 2007 Author Share Posted September 30, 2007 also, i took a look at the addsx.com code, and it looks like this, there is no advanced java or anything in there code, simply a text change. the question is, how???? here is the code they used with the add me images: <form action="" method="post" target="_self"> <input type="hidden" name="a" value="[213293954]" /><input type="image" src="http://i23.tinypic.com/sytksx.gif" onclick="window.open('http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify'amp;apos;friendID=213293954')" name="submit" /> </form> <span style="font-weight: bold; color: #009999">Not added =(</span> Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 30, 2007 Share Posted September 30, 2007 I'm really not sure what mrore you want or what you are trying to accomplish. The code I provided was a viable solution. Do you have anyidea what you are planning to do with this information on the back end? If you don't know what extension to give the file, then you need to learn more about tyhe technology and how it is used. PHP is used to create HTML. If you were to name the file as PHP it will work fine as long as it is run on a server with PHP. Or, you could simple name it as an HTML file. Take a look at this (save as an html file): <html> <head> <style> img { border: 0px; } .added { color:#22dd66; font-size:14pt; font-weight:bold; } .notadded { color:#44ccff; font-size:14pt; font-weight:bold; } </style> <script type="text/javascript"> oldTextAry = new Array(); function changeText (textFieldID) { textFieldObj = document.getElementById(textFieldID); textFieldObj.className = 'added'; textFieldObj.innerHTML = 'Added '; } </script> </head> <body> <a href="#" onclick="changeText('text1')"><img src="http://i18.tinypic.com/6akphsz.gif"></a> <br><div id="text1" class="notadded">Not added =(</div> </body> </html> Quote Link to comment Share on other sites More sharing options...
addtrain Posted October 1, 2007 Author Share Posted October 1, 2007 what i am trying to do is make (when you click on the image), a seperate window (target="_blank") opens up, and at the same time the text changes...once ALL OF THE IMAGES HAVE BEEN CLICKED ON, an input below changes from disabled, to abled. Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 2, 2007 Share Posted October 2, 2007 The last code I posted pretty much does that. You would just need to give the link a href value and a target value. As for the last part you mentioned, with disabling the form, that would be just more javascript. Quote Link to comment Share on other sites More sharing options...
addtrain Posted October 2, 2007 Author Share Posted October 2, 2007 i dont get how i can make it abled...do you know how? Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 3, 2007 Share Posted October 3, 2007 This particular forum is for PHP. If you have any further questions/isues you should raise it in the Javascript forum. Also, most of these forums are intended for people to get help with their code, not to have someone write it all for them. <html> <head> <style> img { border: 0px; } .added { color:#22dd66; font-size:14pt; font-weight:bold; } .notadded { color:#44ccff; font-size:14pt; font-weight:bold; } </style> <script type="text/javascript"> oldTextAry = new Array(); function changeText (textFieldID) { textFieldObj = document.getElementById(textFieldID); textFieldObj.className = 'added'; textFieldObj.innerHTML = 'Added '; divsArray = document.getElementsByTagName('div'); for (i=0; i<divsArray.length; i++) { if(divsArray[i].className=='notadded') { return false; } } document.getElementById('submit').disabled = false; return true; } </script> </head> <body> <a href="http://www.yahoo.com" target="_blank" onclick="changeText('text1')"><img src="http://i18.tinypic.com/6akphsz.gif"></a> <br><div id="text1" class="notadded">Not added =(</div> <a href="http://www.google.com" target="_blank" onclick="changeText('text2')"><img src="http://i18.tinypic.com/6akphsz.gif"></a> <br><div id="text2" class="notadded">Not added =(</div> <a href="http://www.phpfreaks.net" target="_blank" onclick="changeText('text3')"><img src="http://i18.tinypic.com/6akphsz.gif"></a> <br><div id="text3" class="notadded">Not added =(</div> <button type="submit" id="submit" disabled="disabled">Click here to join!</button> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.