How do you do this? (dot, circle etc.)

T

Thomas 'PointedEars' Lahn

Don84 said:
Could we do something about it?

Yes, "we" could set the margins.
My previous update post indicated it's no longer an issue.

Your "previous update post" was only submitted a few minutes before
I wrote my reply. NetNews is not a real-time communications medium.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Don84 said:
Here's an update. Please see below.
Also, new question, how to add an external link to one or many DIV
(s).

my attempt 1
div[x].href.document.location = "externaLink.html"
failed

my attempt 2
div[x].onclick = "externaLink.html"
also failed

Read The Fine Manual ...

.... and don't top-post.


PointedEars
 
D

Don84

Don84 said:
Here's an update.  Please see below.
Also, new question, how to add an external link to one or many DIV
(s).
my attempt 1
div[x].href.document.location = "externaLink.html"
failed
my attempt 2
div[x].onclick = "externaLink.html"
also failed

Read The Fine Manual ...
Please elaborate.

I did some research on it. key code "pieces":

....
var divX = document.createElement("divX");
divX.appendChild(document.createTextNode("marketing strategy"));
....

// add link to the TextNode of "marketing strategy", even the divX
element
// Detail.html file exists in the current path

divX.href = "Detail.html";
// outcome: failed

divX.setAttribute('href', 'Detail.html');
// outcome: failed

What now?

Greatly appreciate it as usual.
 
T

Thomas 'PointedEars' Lahn

Don84 said:
Thomas said:
Don84 said:
Here's an update. Please see below.
Also, new question, how to add an external link to one or many DIV
(s).
my attempt 1
div[x].href.document.location = "externaLink.html"
failed
my attempt 2
div[x].onclick = "externaLink.html"
also failed

Read The Fine Manual ...
Please elaborate.

I did some research on it.

Not enough.
key code "pieces":

...
var divX = document.createElement("divX");

RTFM: <http://www.w3.org/TR/DOM-Level-3-Core/core.html#i-Document>

document.createElement() expects an element *type* name (colloq.: tag name),
not an element name. There is no `divX' element in Valid (X)HTML (XHTML
modules aside).
divX.appendChild(document.createTextNode("marketing strategy"));
...
OK.

// add link to the TextNode of "marketing strategy",

By definition, that is not possible. A text node is a *text* node.
even the divX element
Pardon?

// Detail.html file exists in the current path

divX.href = "Detail.html";
// outcome: failed

divX.setAttribute('href', 'Detail.html');
// outcome: failed

The latter works for me, despite the wrong element type name.
What now?

Create a DIV element (HTML) or a `div' element (XHTML). Of course, a
DIV/div element is not an A/a element; it has no `href' attribute, and the
corresponding object has no `href' property. (You should know what to do
now.)


PointedEars
 
D

Don84

Took a look, not getting much out of it. Drinking some coffee now :)
probably won't help much
document.createElement() expects an element *type* name (colloq.: tag name),
not an element name.  There is no `divX' element in Valid (X)HTML (XHTML
modules aside).

I thought "divX" as in the following code represent an newly created
object or a node or element for that matter
var divX = document.createElement("divX");
divX.appendChild(document.createTextNode("marketing strategy"));

You lost me on "expects an element *type* name (colloq.: tag name),"
By definition, that is not possible.  A text node is a *text* node.
You lost me here as well. I need some text like "marketing strategy"
to show up next to each newly created red dot. If not TextNode then
please advise what?
The latter works for me, despite the wrong element type name.
How do "we" make the latter one function correctly? btw, what browser
and version did you use to make "the rabbit hits the tree"?

Thanks a million.
 
T

Thomas 'PointedEars' Lahn

Don84 said:
Took a look, not getting much out of it. Drinking some coffee now :)
probably won't help much

That is correct. Only reading, thinking, and programming is going to help.
In that order.
I thought "divX" as in the following code represent an newly created
object or a node or element for that matter
var divX = document.createElement("divX");

Have you ever seen any said:
^^^^^^^^^^^^^^^^^^^^^^^
How do "we" make the latter one function correctly?

"We" create a `DIV' element and not a `divX' element, because there is no
`divX' element in HTML.
btw, what browser and version did you use to make "the rabbit hits the
tree"?

I am not familiar with that idiom. If it means "work", I used Iceweasel
3.5.3.


PointedEars
 
D

Don84

Have you ever seen any <divX>...</divX> in HTML?

Sorry we failed to communicate at my fault. The above "divX" is a
element name or object name as they like to call it but not element
type of <DIV> or <p> or <table> etc. and the following code would
prove it. It works fine with IE7.

var div2 = document.createElement("div2");
if (div2)
{

/* Some layout engines don't display elements without content */
div2.appendChild(document.createTextNode("div20"));

div2.style.position = "absolute";
div2.style.left = "200";
div2.style.top = "190px";
div2.style.width = "20px";
div2.style.height = "20px";
div2.style.backgroundColor = "red";

document.body.appendChild(div2);
}

                                        ^^^^^^^^^^^^^^^^^^^^^^^


"We" create a `DIV' element and not a `divX' element, because there is no
`divX' element in HTML.

Ok, how can "we" create an element named "divX", of type "DIV"? Just
checked the reference doc you mentioned to no avail.

Many thanks.
I am not familiar with that idiom.  
Accidental reward or the like.
If it means "work", I used Iceweasel
3.5.3.
Thanks for the info.
 
T

Thomas 'PointedEars' Lahn

Don84 said:
Sorry we failed to communicate at my fault. The above "divX" is a
element name or object name as they like to call it but not element
type of <DIV> or <p> or <table> etc. and the following code would
prove it. It works fine with IE7.

That doesn't prove anything but confirms that MSHTML still provides the
buggiest DOM implementation out there.
var div2 = document.createElement("div2");

Have you ever seen said:
[...]
"We" create a `DIV' element and not a `divX' element, because there is no
`divX' element in HTML.

Ok, how can "we" create an element named "divX", of type "DIV"? Just
checked the reference doc you mentioned to no avail.

<http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-2141741547>

Please leave an attribution line for each quotation level.
I am sure someone has told you this before.


PointedEars
 
D

Don84

Here's an update.

I figured out how to add a link to a dynamically created element.
Now, a new question arises, how to trigger a javascript event
(onMouseOver in this case)

// create a DIV element
var div = document.createElement("div");
// create some text for it
var showTxt = document.createTextNode("show more data about marketing
strategy");
// append the text to the DIV
div.appendChild(showTxt);
// initially not show the text
div.style.display = "none";

Now, what I want to do is, onMouseOver, show the text, attempted the
following code to no avail.
div.setAttribute("onMouseOver", "javascript:div.style.display =
'inline'");

What's wrong?

Many thanks.
Please leave an attribution line for each quotation level.
I am sure someone has told you this before.

All right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top