Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 06-05-2006, 12:57 AM JS DOM error-thingy
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
Hi,

Ig got myself a little problem here. I am all new to JavaScripting and the whole related DOM-thingy so please bare with me.

Why do not this work!?

Code:
<script type="text/javascript">
   <![CDATA[
      var insertelement = document.getElementById('insertemailhere')
      insertelement.appendChild(document.createTextNode('E-post: '))
      var ns = 'http://www.w3.org/1999/xhtml'
      var emaillink = document.createElementNS(ns,'a')
      emaillink.setAttributeNS (ns,'href','mailto:kontaktATLASchristianknappskog.com?subject=Kontakt%20fra%20christianknappskog.com')
      emaillink.setAttributeNS(ns,'title','Ta kontakt!')
      emaillink.appendChild(document.createTextNode('kontaktATLASchristianknappskog.com'))
      insertelement.appendChild(emaillink)
   ]]>
</script>
<p id="insertemailhere"></p>
To be used in an XHTML document (application/xhtml+xml).
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-05-2006, 05:09 AM Re: JS DOM error-thingy
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
define, "doesn't work". as in what does it or not do

you are missing the @ symbol in the email adresses though.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-05-2006, 05:15 AM Re: JS DOM error-thingy
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
don't work = I do not know what is causing it to not write the output.
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
Old 06-05-2006, 05:55 AM Re: JS DOM error-thingy
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
How are you debugging it. I would suggest using the javascript console in FireFox

1/ How are you calling the script, If it runs before the <p> is created it will fail

2/ the "<![CDATA" will cause an error if it is in a XHTML document rather than an XML document that is being transformed with XSLT.

works ok for me, once the above points are rectified BTW
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to JS DOM error-thingy
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.56893 seconds with 12 queries