|
I assume it isn't a Data Flow Diagram.
|
|
|
|
|
I assume it is a Data Flow Diagram, he probably wants to put a mockup diagram on the DFD.
|
|
|
|
|
I have a large list of authors, book titles, and comments in an SQL database. I am able to pull those records with PHP.
I want to populate a web form with this information dynamically (Javascript), but since I have never used AJAX or json, I've not known how to do this any other way.
So what I've done is have my PHP generate a 2D Javascript array which contains all of the entries like this:
var author_title_comment = new Array();
author_title_comment.push( new Array("Author 1", "Title 1", "Comment 1") );
author_title_comment.push( new Array("Author 2", "Title 2", "Comment 3") );
...
author_title_comment.push( new Array("Author 3999", "Title 3999", "Comment 3999") );
author_title_comment.push( new Array("Author 4000", "Title 4000", "Comment 4000") );
It's not pretty, but it functions well locally.
The same thing could probably be re-written like this:
var author_title_comment = [];
author_title_comment[author_title_comment.length] = new Array("Author 1", "Title 1", "Comment 1");
author_title_comment[author_title_comment.length] = new Array("Author 2", "Title 2", "Comment 2");
...
author_title_comment[author_title_comment.length] = new Array("Author 3999", "Title 3999", "Comment 3999");
author_title_comment[author_title_comment.length] = new Array("Author 4000", "Title 4000", "Comment 4000");
Since the push() function can handle more than a single entry[^], would this be more efficient:
var author_title_comment = new Array();
author_title_comment.push(
new Array("Author 1", "Title 1", "Comment 1"),
new Array("Author 2", "Title 2", "Comment 3"),
...
new Array("Author 3999", "Title 3999", "Comment 3999"),
new Array("Author 4000", "Title 4000", "Comment 4000")
);
So I can either 1: use author_title_comment.push( new Array("Author 1", "Title 1", "Comment 1") ); on every element I want to add. 2: use author_title_comment[author_title_comment.length] = new Array("Author 1", "Title 1", "Comment 1"); on each element, or 3: use a single push() with all 4000 elements as additional parameters.
Or #4, learn a better way to do this and have the content dynamically generated whenever the user adds/removes a new author name, book title, or comment.
|
|
|
|
|
#4 Learn a better way. JSON Examples[^]
JSON is basically a collection of name/value pairs
"books":
{
"book":
[
{"author": "John Steinbeck", "title": "Grapes of Wrath", "comments": "Lenny killed the rabbit" }
]
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
<a id="href1" href="#">gogo</a>
function goUrl(url) {
location.href = url;
}
i want to add goUrl event to href tag when i click href.
below is what i try.
var href1_obj = document.getElementById("href1");
//this is start as soon as load window.
href1_obj.onClick = goUrl("http://naver.com");
How can i do that?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
function goUrl(url)
{
var temp = url;
return function() { location.href = temp; };
}
This will do the trick as the onClick handler needs to receive a function.
Cheers!
—MRB
|
|
|
|
|
|
i am sorry, i misunderstand.
This function is working.
Thank you have a nice day!!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Your welcome!
|
|
|
|
|
hello!
If u use jquery. It is easy to do this.
Demo
<a id='name_of_id'>click here</a>
<script type='text/javascript'>
$("#name_of_id").click(function(){
});
</script>
|
|
|
|
|
100 , sir;
good to meet you again on the same thread. Where were you, man?!!
Help people,so poeple can help you.
|
|
|
|
|
I'm very busy lately, so I don't have as much time to spend here as before.
Nice to meet you again too!
|
|
|
|
|
the statement goUrl("http://naver.com"); dosent return a reference to a function, instead it returns a void.
Instead of that you can replace it with
href1_obj.onclick = function(){goUrl("http://naver.com")};<br />
Help people,so poeple can help you.
|
|
|
|
|
|
i am sorry, i misunderstand.
This function is working.
Thank you have a nice day!!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Your welcome!
Help people,so poeple can help you.
|
|
|
|
|
JQuery[^] makes this very easy to do.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you, Mark;
Help people,so poeple can help you.
|
|
|
|
|
hi
L want click the button and save the div to the html file
thank you
|
|
|
|
|
Click what button? Save the div how; do you mean the source code or the screen display? Please try and reword your question to explain more clearly what problem you are trying to solve.
The best things in life are not things.
|
|
|
|
|
hi
I want click any button on the page then open the dialog to save the
content page to html format
thanks
|
|
|
|
|
I think you said that in your previous question. Which part are you having problems with?
The best things in life are not things.
|
|
|
|
|
I want when user click in my button just save the content page with any format could you help me?
Regards.
|
|
|
|
|
Some suggested possibilities here[^].
The best things in life are not things.
|
|
|
|
|
Legend create dynamic , I used jquery for create Legend GUI with click callback. each div have ID. expectation is while clicks div, the corresponding ID want to show. But here its showing only at last created div id only
<div id="legend"></div>
for (var i = 0; i < 3; i++) {
var id = "test" + i;
$("<div/>", {
"id": id,
"style": "width:30px; height:30px cursor:pointer; border:1px solid Green ;padding:1px; background-color:Green",
click: function() {
alert("ID = "+ id);
}
}).appendTo("#legend");
|
|
|
|