Javascript inside html tag

Hi,

I remember there used to be a way to parse the output of a Javascript function or the value of a variable inside an HTML tag. But how did it work again?

In PHP you can use <?= $variable ?> as for ASP something like <%= variable %> I thought there was a similar thing for JavaScript Like <@= varable > or so. Can anyone tell me what it is... ???

I need to do something like this:
[code]


param = document.location.href.split('?');



" ...
...




...etc.

[/code]
;-)
-mac-
mailto:[email protected]
the Netherlands...

Comments

  • : Hi,
    :
    : I remember there used to be a way to parse the output of a Javascript function or the value of a variable inside an HTML tag. But how did it work again?
    :
    : In PHP you can use <?= $variable ?> as for ASP something like <%= variable %> I thought there was a similar thing for JavaScript Like <@= varable > or so. Can anyone tell me what it is... ???
    :
    : I need to do something like this:
    : [code]
    :
    :
    : param = document.location.href.split('?');
    :
    :
    :
    : " ...
    : ...
    :
    :
    :
    :
    : ...etc.
    :
    : [/code]
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    The only way I know of, which can do that is the javascript command: document.write(). Using this command you write the entire tag into the page. I'm not sure if it will work.
  • : : Hi,
    : :
    : : I remember there used to be a way to parse the output of a Javascript function or the value of a variable inside an HTML tag. But how did it work again?
    : :
    : : In PHP you can use <?= $variable ?> as for ASP something like <%= variable %> I thought there was a similar thing for JavaScript Like <@= varable > or so. Can anyone tell me what it is... ???
    : :
    : : I need to do something like this:
    : : [code]
    : :
    : :
    : : param = document.location.href.split('?');
    : :
    : :
    : :
    : : " ...
    : : ...
    : :
    : :
    : :
    : :
    : : ...etc.
    : :
    : : [/code]
    : : ;-)
    : : -mac-
    : : mailto:[email protected]
    : : the Netherlands...
    : :
    : :
    : The only way I know of, which can do that is the javascript command: document.write(). Using this command you write the entire tag into the page. I'm not sure if it will work.
    :

    I'm pretty sure something else should work also

    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • : : : Hi,
    : : :
    : : : I remember there used to be a way to parse the output of a Javascript function or the value of a variable inside an HTML tag. But how did it work again?
    : : :
    : : : In PHP you can use <?= $variable ?> as for ASP something like <%= variable %> I thought there was a similar thing for JavaScript Like <@= varable > or so. Can anyone tell me what it is... ???
    : : :
    : : : I need to do something like this:
    : : : [code]
    : : :
    : : :
    : : : param = document.location.href.split('?');
    : : :
    : : :
    : : :
    : : : " ...
    : : : ...
    : : :
    : : :
    : : :
    : : :
    : : : ...etc.
    : : :
    : : : [/code]
    : : : ;-)
    : : : -mac-
    : : : mailto:[email protected]
    : : : the Netherlands...
    : : :
    : : :
    : : The only way I know of, which can do that is the javascript command: document.write(). Using this command you write the entire tag into the page. I'm not sure if it will work.
    : :
    :
    : I'm pretty sure something else should work also
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    :

    Ah I found it again in one of my very old books: webmaster in a nutshell:
    [code]



    [/code]
    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • [b][red]This message was edited by mac_doggie at 2005-4-18 12:25:35[/red][/b][hr]
    : : : : Hi,
    : : : :
    : : : : I remember there used to be a way to parse the output of a Javascript function or the value of a variable inside an HTML tag. But how did it work again?
    : : : :
    : : : : In PHP you can use <?= $variable ?> as for ASP something like <%= variable %> I thought there was a similar thing for JavaScript Like <@= varable > or so. Can anyone tell me what it is... ???
    : : : :
    : : : : I need to do something like this:
    : : : : [code]
    : : : :
    : : : :
    : : : : param = document.location.href.split('?');
    : : : :
    : : : :
    : : : :
    : : : : " ...
    : : : : ...
    : : : :
    : : : :
    : : : :
    : : : :
    : : : : ...etc.
    : : : :
    : : : : [/code]
    : : : : ;-)
    : : : : -mac-
    : : : : mailto:[email protected]
    : : : : the Netherlands...
    : : : :
    : : : :
    : : : The only way I know of, which can do that is the javascript command: document.write(). Using this command you write the entire tag into the page. I'm not sure if it will work.
    : : :
    : :
    : : I'm pretty sure something else should work also
    : :
    : : ;-)
    : : -mac-
    : : mailto:[email protected]
    : : the Netherlands...
    : :
    : :
    : :
    :
    : Ah I found it again in one of my very old books: webmaster in a nutshell:
    : [code]
    :
    :
    :
    : [/code]
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    :


    Hmmm (I see they call it JavaScript entities and their like HTML entities < &amp etc.),

    doesn't seem to work anymore... It says this works with Javascript 1.1 (maybe they removed it from later versions...?)
    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...




  • Very nice, I never know about them. According to http://wsabstract.com/javatutors/entity3.shtml though, they don't work in IE, and my quick test didn't give any results in Firefox or Konqueror either - the former didn't apply it, the latter doesn't show anything. My guess is that they just faded into obscurity at some point and got thrown out when Gecko replaced Mozilla.

    There are ways you could duplicte it, however. It would be a matter of running something like:
    [code]for (var elem in document.getElementsByTagName('*'))
    for (var attrib in elem.attributes)
    attrib.nodeValue.replace(/&{(.*?)};/, eval("1")));[/code]
    ^D
    $ shameless-plug
    http://line-ed.sourceforge.net

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories