![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista
|
[SOLVED] Forms
Hi People
![]() Is it possible to invoke a js function on the same page as the form...or do I have to implement the code on a separate page designated with the action tag? BrentC |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
[code]<a onclick="javascript:JAVASCRIPT CODE HERE;">CLICKABLE LINK</a>
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2
|
Re: Forms
No, no javascript: if you're using an onclick.
Either <a href="javascript:functionCall(params);">Click</a> or <a onclick="functionCall(params);">Click</a>' I typically use the first method. You can definitely use the js on the same page, the action is for server side code (php, asp, etc) needs to be executed. |
|
|
|
|
|
#6 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Wow, good catch Fred... I really do have to quit coding at well... whatever time that was... EDIT: It was like 2am my time.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. Last edited by ahmorrow; 07-21-2009 at 07:34 PM. Reason: did some math... |
|
|
|
|
|
#8 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Yeah, I realize what you were trying to do now... I totally screwed that one up lol. Server-Side and Client-Side are sadly different.
An alternative would be to email it instead of using the action method... but I don't know... the problem isn't really clear to me.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#9 (permalink) |
|
Registered User
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista
|
Re: Forms
I am displaying Youtube videos. When I use
<a href="javascript:name('theme')">thetheme</a> that works ok. But I want to also have the user enter any theme in a text box in a form. That does not work. Like Fred said I'll have to go to a (in my case) php page and generate the js from there. The Youtube API comes with js link as well. Check out my page here: As you will see, clicking on a preset theme works - some videos with the theme are presented. But not if you enter a 'custom' them. |
|
|
|
|
|
#10 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Ummm... I don't see a link 0.0
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#11 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2
|
Re: Forms
No, not necessarily, you can use js to get data from the form. I thought you were trying to send it to a database or email it or something. If it's staying on the page, that's fine.
Code:
<form onsubmit="name(document.getElementById(searchbox))">
<input type="text" id="searchbox" />
<input type="submit" value="Submit" />
</form>
|
|
|
|
|
|
#12 (permalink) |
|
Registered User
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista
|
Re: Forms
That is still not working...I'll try putting the link to my page here again
http://24.67.40.54/youtube/enter_content.html |
|
|
|
|
|
#15 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Typing in the name of the variable (video?) would need to be case sensitive. So This != this. You'd need to be sure to type everything into that box exactly.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#16 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Code:
<a href="javascript:OnLoad('ads')" style="position:absolute; top:100; left:100">ADS</a>
It just doesn't make sense to me. Code:
<form> <input size="25" type="text" id="myText" value="vw"> <input type="button" value="Select text" onclick="OnLoad()"> </form> Code:
<form>
<input size="25" type="text" id="myText">
<input type="button" value="Select text" onclick="OnSubmit('document.getElementById(myText)')">
</form>
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#18 (permalink) |
|
Registered User
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista
|
Re: Forms
Ok I've got it working now...The OnLoad was a my function name (not to confuse it with onload=name() in a body tag.)
I tried what you and Fred said and it did not work. But after some perseverence I got it working. As I said above I want the user to enter a 'theme' for the videos on the right. Here is the form code... <form id="myText" > <input size="25" type="text" name="me" value="beer" /><br /> <input type="button" value="Select text" onclick="mytheme()"> </form> I changed the function name to mytheme. Then I added some simple js to detect if the mytheme function is being passed a preset theme or a 'custom' theme. Thanks for your efforts guys...I will probably need you in future. It's good to have people who know this stuff to bounce off... Brent |
|
|
|
|
|
#20 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Forms
Yeah, I was thinking onload was a reserved word that you can't use as a variable/function. Could be wrong, but that might've been it.
Oh well, seems to be working if a bit messed up looking in Firefox. The title is covering the button/textbox and the links are smudged in there too. Glad it worked out, if you could go up to Thread Tools at your first post, and select "Mark Post As Solved" or whatever it is.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
![]() |
| Thread Tools | |
|
|