Help: Running a function when clicked.
Started by Bannana97, Feb 02 2009 06:08 PM
11 replies to this topic
#1
Posted 02 February 2009 - 06:08 PM
How would I?
How do I make a function too?
do I use:
<function install()>
COMMAND
</function>
?
And How would I run it?
Like this?:
onclick="javascript:function install()"
How do I make a function too?
do I use:
<function install()>
COMMAND
</function>
?
And How would I run it?
Like this?:
onclick="javascript:function install()"
|
|
|
#2
Posted 02 February 2009 - 08:03 PM
I suggest you read more about javascriptWiki. Usually, those are written within <script> tags in the html page, or linked to a separate file, with the same tag.
It is a little bit large subject to describe here, but take a look at W3Schools Online Web Tutorials, where this is one of the javascript tutorials you want to look at: Tryit Editor v1.4
It is a little bit large subject to describe here, but take a look at W3Schools Online Web Tutorials, where this is one of the javascript tutorials you want to look at: Tryit Editor v1.4
#4
Posted 03 February 2009 - 09:31 AM
as orjan said you must read about JS first
anyways heres a little pointers:
-to connect a control with an event to start a function, first you need to write the JS function in the <script> tags, then call the function from the html control, heres a page with an alert function
anyways heres a little pointers:
-to connect a control with an event to start a function, first you need to write the JS function in the <script> tags, then call the function from the html control, heres a page with an alert function
<html>
<head>
<script type="text/javascript">
function msg()
{
alert('you clicked a button');
//do commands here
}
</script>
</head>
<body>
<input type="button" value="click me!" onclick="msg()" />
</body>
</html>
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript
#5
Posted 03 February 2009 - 09:37 AM
Be aware that some browsers may have JavaScript disabled, in which case the function call will fail. Always implement some sort of fallback plan, perhaps standard HTML, or maybe PHP, which cannot be interfered with in the browser, as it is server-side rather than client-side.
#6
Posted 03 February 2009 - 10:12 AM
for the purpose scripting is turned off, there is a <noscript> tag to use.
#8
Posted 03 February 2009 - 02:17 PM
But it gives the opportunities to alter the html code depending on scripts or not at least, maybe some other arrangements could be done instead.
#10
Posted 10 February 2009 - 07:35 PM
Many people disable it due to security based reasons. You could also set a script up that checks to see if JavaScript is disabled. If it is show a message it is required to view the site, if it is enabled, just redirect to the normal JavaScript page.
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation
Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!
#11
Posted 10 February 2009 - 08:09 PM
Brandon W said:
Many people disable it due to security based reasons. You could also set a script up that checks to see if JavaScript is disabled. If it is show a message it is required to view the site, if it is enabled, just redirect to the normal JavaScript page.
That's what the <noscript> tag is used to. as the <noframes> tag if a browser shouldn't support frames.
#12
Posted 12 February 2009 - 12:54 PM
Brandon W said:
Many people disable it due to security based reasons.
JavaScript is a basic and largely integral part of web design. To disable it is like using a pneumatic drill to crack open a nut.


Sign In
Create Account

Back to top









