Results 1 to 2 of 2

Thread: insert text

  1. #1
    Join Date
    Jul 2014

    insert text

    I am trying to insert text using a script and having trouble:
    var ga[];
    ga[0] = "Joe";
    function dataarrayinsert(){
    return ga[0];

    <mark>Name: </mark>
    function dataarrayinsert()

  2. #2
    Join Date
    Mar 2007
    I should say so.

    For one, you don't declare an array like you have or use a function like that and how are you to insert something in to a tag if you have no way of hooking the HTML element.

    To declare an array...
    var ga = new Array();
    To declare an array with elements already set
    var ga = new Array("Joe");
    The short cut method of creating an array
    var ga = [];
    The short cut way of making an array with elements
    var ga = ["Joe"];
    Declare a function
    function someFunction(){
    do stuff
    someFunction = function(){
    // do stuff
    Call the function
    Any JavaScript has to be wrapped in html <script></script> tags.

    To add something to the <mark> tag, you would need to give it an id, then hook that id, then manipulate it, eg.

    HTML Code:
    var ga = ["Joe"];
    function someFunction(t,data){
        o.innerHTML = o.innerHTML + " "+data;
    <mark id="targetID">Name: </mark>
    I hope that this has been of some benefit to you.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles