frozentree Posted February 12, 2006 Share Posted February 12, 2006 erm.....can anyone help me here? am having problem with the .......function.guys, trying so hard but cant think of anything anymore that need to repair this script. me try to make the input value and when u click the second button. it should show the output value. well i did follow some example but wanna see how far it can go somemore.<html><head><script type="text/javascript">function mainpart (text){ref="0123456789abcdefghijklmnopqrstuvwxyz-~ABCDEFGHIJKLMNOPQRSTUVWXYZ"result="" ;for(kira=0;kira<text.length;kira++){firstrow=text.substring(kira,kira+1) secondrow=ref.indexOf(firstrow) thirdrow=ref.substring(secondrow+1,secondrow+2) result+=thirdrow}function extendedpart(gg){return (document.grass.magic.value=result)}}</script></head><body><form name="grass">check this::<input type=text name="text"><input type=button value="send" onclick="mainpart (document.grass.text.value)"><br>appear here::<input type=text name="magic"><input type=button value="recieving" onclick="extendedpart(document.grass.magic.value)"></form></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted February 13, 2006 Share Posted February 13, 2006 you can't declare functions inside another function Link to comment Share on other sites More sharing options...
frozentree Posted February 13, 2006 Author Share Posted February 13, 2006 oo ic..thanks for the info Link to comment Share on other sites More sharing options...
Guest Sanjeewa Posted February 14, 2006 Share Posted February 14, 2006 Yes dude u can inside another function:example :function name(){function age() { /* add ur statements */}}then if you want to call the age function first of all call name and call age.. Link to comment Share on other sites More sharing options...
frozentree Posted February 14, 2006 Author Share Posted February 14, 2006 if can make this happen....then how do i call the main function ---> function name() followed by function age() ?? i try this<head><script type="text/javascript">function watchtree(a,b,c,d){ winter= a+b+c-d ; function ball(winter) { return(winter) }}</script></head><body>document.write(watchtree(ball(2,2,2,2)))</body> Link to comment Share on other sites More sharing options...
aspnetguy Posted February 14, 2006 Share Posted February 14, 2006 Yes dude u can inside another function:example :function name(){function age() { /* add ur statements */}}then if you want to call the age function first of all call name and call age.. <{POST_SNAPBACK}> or you could do this which is much easierfunction name(){ age();}function age(){} That way you can call age() directly very easily Link to comment Share on other sites More sharing options...
scott100 Posted February 14, 2006 Share Posted February 14, 2006 if can make this happen....then how do i call the main function <{POST_SNAPBACK}> I wouldn't put a function inside another, that's just messy, try something like this <head><script type="text/javascript">function watchtree(a,b,c,d){ winter=a+b+c-d; winter=ball(winter); return winter;}function ball(winter){ z=winter+10; return(z);}</script></head><body><script type="text/javascript"> var result=watchtree(2,2,2,2); document.write(result);</script></body> Link to comment Share on other sites More sharing options...
frozentree Posted February 15, 2006 Author Share Posted February 15, 2006 thanks all of u guys!! it really help me a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now