Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript or html

    Me and my friend were having a debate,

    is this javascript or html

    Code:
    onclick="alert('some text here')"
    that was used in a input type area of a form

    i believe it is javascript as it is a javascript command! please prove him wrong mwahahahaha
    ...not bad for a thirteen year old

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    If you want to prove it, disable Javascript on the browser and see if it runs....I bet it will not run
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    May 2004
    Location
    Some place called the Earth I think...
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by aspdude2004
    Me and my friend were having a debate,

    is this javascript or html

    Code:
    onclick="alert('some text here')"
    that was used in a input type area of a form

    i believe it is javascript as it is a javascript command! please prove him wrong mwahahahaha
    hey ur thirteen 2? so am I, can i see one of your sites?
    Dont do drugs, get high on life

    13 years and getting nowhere fast.....


    M_Mk

  • #4
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yea im currently working on a php site, but the only one working at the mo is

    Click Here
    ...not bad for a thirteen year old

  • #5
    New Coder
    Join Date
    Nov 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    omg im 13 too.

    Yeah, thats definetly JavaScript.

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    onclick is an event. An event like this is an attribute that can be used on almost any tag. They allow you to assign javascript statements to them, bridging the gap between HTML and javascript. Please use the PM system for personal conversations and greetings that are don't contribute to the topic.

  • #7
    Master Coder
    Join Date
    Feb 2003
    Location
    Ume, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by aspdude2004
    Me and my friend were having a debate, is this javascript or html

    Code:
    onclick="alert('some text here')"
    Well, it's both. onclick is an HTML attribute name, and the string "alert('some text here')" is an HTML attribute value, that together forms an attribute.

    The onclick attribute happens to be an eventhandler attribute. That means that it will be sent to the default scripting engine for parsing. The default scripting engine would for most pages be JavaScript.

    The actual content of the attribute value string is then parsed by the JavaScript engine as a function body, and is thus JavaScript. The triggering of the event is a user interaction that is neither HTML nor JavaScript. However, it in turn calls the scripting engine, which will execute the JavaScript function body created from the HTML attribute value.

    If you turn scripting off, you only remove the JavaScript part. The event will still happen, but no code will be parsed as the scripting engine is disabled.


    So, I'm, afraid the correct answer is that you're both right.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •