|
Hi,
I want to add content dynamically to a DIV. What is the difference between using document.createElement() to add content or just adding the HTML using the div's .innerHTML property? I assume this is easier but am I missing something?
Thanks in advance,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
One creates an element. The other parses a text representation of a HTML fragment and inserts it in place of an element's current children.
One lets you create elements in a clear, controlled, and generally verbose fashion. The other allows / requires you to create a string representation of what you want.
One is an existing standard[^]. The other is a proposed standard[^] (based on a common - but non-standard - implementation).
In practice, which one you should use really depends on what you're trying to do...
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Thank you is it considered bad practice to use the .innerHTML method because using the document.createElement() method would require a lot of code as lots of elements are created, all with different styles etc.
Thanks for your help,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
It really does depend on what you're doing. innerHTML is rather widely supported, so if you need it i wouldn't worry about using it. It can be cleaner and faster than trying to build a large or complicated DOM fragment using other methods. It can also degenerate into a mess of string manipulation complete with subtle errors that only show up on certain browsers due to the various methods used to "correct" invalid HTML.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Ah yes I see your point, it can get messy, especially when the browser tries to close tags, for example
Thanks for your help
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi All,
I am looking for some advice/direction on software documentation, i work as the only developer in a very small company, its my first job after college so i have no real documentation experience and the company is new so basically there is none at the moment. I am developing a web app using C#, ASP.Net, VS2008 and SQL Server 2005 and have spent the last week trying to find info on where to start but no luck, so im just wondering if anyone could give me some advice or point me in the direction of some examples or anything really.
Thanks in advance
Tim
|
|
|
|
|
tadhg88 wrote: have spent the last week trying to find info on where to start but no luck
I can't understand how that could happen unless you explain "how" you have been trying.
Where to start is a tough ambiguous problem. As a wild guess where a good place for "you" to start, I would offer this[^]. It has a link to a PDF so I assume you will have no problem viewing the document.
Any future questions about documentation or process should probably go in the General Discussion forum.
led mike
|
|
|
|
|
for the first question:
pliz help me, i keep getting the error
[i]Notice: Undefined index: cat in c:\program files\easyphp1-8\www\myhelpdesk\postqueryagain.php on line 40[/i]
if i remove the line $cat=$_GET['cat']; the second drop down menu doesnt function well thanx guys
[code]
include('connect_db.php');
$quer2=mysql_query("SELECT DISTINCT typename,probtypeid FROM probtype order by typename");
$cat=$_GET['cat'];//This line is added to take care if your global variable is off
if(isset($cat) and strlen($cat) > 0)
{
$quer=mysql_query("SELECT DISTINCT catname FROM category where probtypeid=$cat order by catname");
}
else
{
$quer=mysql_query("SELECT DISTINCT catname FROM category order by catname");
}
echo "";
//Add your form processing page address to action in above line. Example action=dd-check.php
// Starting of first drop downlist
echo "select problem type";
while($noticia2 = mysql_fetch_array($quer2))
{
if($noticia2['probtypeid']==@$cat)
{
echo "$noticia2[typename]"."";
}
else
{
echo "$noticia2[typename]";
}
}
echo "";
//Starting of second drop downlist
echo "Select problem category";
while($noticia = mysql_fetch_array($quer))
{
echo "$noticia[catname]";
}
echo "";
//This will end the second drop down list
echo "";
?>
[/code]
i want to insert the id of the catname.thanx guys
nahelna
|
|
|
|
|
If you're wondering why your question got marked down it's probably because of essay-sized title and ugly code-dump.
Without paying any attention to your code or what you are trying to do, the error message tells you everything you need to know. On line 40 of the code (whichever that is, I'm not figuring it out from here) something is trying to access the 'cat' element of an array. This element doesn't exist, hence the error.
|
|
|
|
|
sorry guess am just confused,forgot to use the tags,
i tried to remove it but when i do that the second dropdown menu stops depending on the first dropdown menu.
ok, is there anyway i can generate two dropdown menus one depending on the other
the error is
Notice: Undefined index: cat in c:\program files\easyphp1-8\www\myhelpdesk\dropdown2.php on line 13
this line reads $cat = $_GET['cat'];//
<?php
$quer2 = mysql_query("SELECT DISTINCT typename,probtypeid FROM probtype order by typename");
$cat = $_GET['cat'];
if(!empty($cat))
{
$quer=mysql_query('SELECT DISTINCT `catname` FROM `category` WHERE`probtypeid`= \''.mysql_escape_string($cat).'\' ORDER BY `catname`');
}
else
{
$quer=mysql_query('SELECT DISTINCT `catname` FROM `category` OREER BY `catname`');
}
echo '<form method="post" name="f1" action="postquery.php">';
echo '<select name="cat" onchange="reload(this.form)">
<option value="">select problem type</option>';
while($noticia2 = mysql_fetch_assoc($quer2))
{
if($noticia2['probtypeid']==@$cat)
{
echo ' <option selected value="',mysql_escape_string($noticia2['probtypeid']),'">',$noticia2['typename'],'</option>',"\n";
}
else
{
echo ' <option value="',$noticia2['probtypeid'],'">',$noticia2['typename'],'</option>',"\n";
}
}
echo '</select>';
echo '<select name="subcat"><option value="">Select problem category</option>',"\n";
while($noticia = mysql_fetch_array($quer))
{
echo ' <option value="',$noticia['catname'],'">',$noticia['catname'],'</option>',"\n";
}
echo '</select>';
echo '</form>';
?>
|
|
|
|
|
by the way when i select a value from a drop down main categoryn the error disappears, why?
|
|
|
|
|
Hi,
Please help -- this is an urgent issue.
i m using remote script in our intranet software which made in asp. we have setup for this software when it stalled it working fine but when i stall on windows 2003 server i m getting error "asking MDAC 2.6" but i cannot stall mdac 2.6 on win 2003. so i have add all the page in intenpub all pages working but except remote script pages not working becouse remote script not executing.
please help me and give example code.
Thanks in advance.
Thanks & Regards
Mohammad Faiz
|
|
|
|
|
mohd faiz wrote: when i stall on windows 2003 server i m getting error "asking MDAC 2.6" but i cannot stall mdac 2.6 on win 2003.
1) Then there's your problem.
2) Wrong forum. This isn't web dev, it's an MDAC or ASP issue.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Hi to all ,
Can anyone help me, I am new to jquery! I would like to add the values entered in the textbox to the dropdown list box with reference on the onblur event in textbox by using jquery
For example,
1 - name1
2 - name2
3 - name3
When user entered the number 1 in textbox, the name1 must add on the dropdown list box.
can anyone guide me Please....?
Thank You
NavaneethaKrishnan P.R.
|
|
|
|
|
That's a bit of an odd UI, but... eh, whatever.
$.fn.addOption = function(optText, optVal)
{
this.filter("select").each(function()
{
var opt = new Option(optText, optVal);
this.options.add(opt);
});
}
$(function()
{
$("#textentry").blur(function()
{
var optionText = $.trim(this.value);
this.value = '';
if ( optionText.length > 0 )
$("#dropdown").addOption(optionText);
});
});
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Thank you Shog for ur kind response first!!
Can u able to give me an example for that to use that jquery and I don't know how to pass the value to the function, and the function seems to be we have to pass the value of both the name and id. is it?
For me the task is that we have to already defined the names for the corresponding numbers like 1=name1, 2=name2,
I want to add the name in drop down when I just press 1 in textbox
Waiting for ur response.
Thank You
|
|
|
|
|
Well, obviously i don't know how you're obtaining IDs or associating names with them, but you could try something like this:
$.fn.addOption = function(optText, optVal)
{
this.filter("select").each(function()
{
var opt = new Option(optText, optVal);
this.options.add(opt);
});
}
var mapIdToName =
{
1 : "name1",
2 : "name2",
3 : "name3",
4 : "George",
5 : "name5"
};
$(function()
{
$("#textentry").blur(function()
{
var optionVal = $.trim(this.value);
var optionText = mapIdToName[optionVal];
this.value = '';
if ( optionText )
$("#dropdown").addOption(optionText, optionVal);
});
});
Something just occurred to me: are you trying to implement an auto-complete / filter system? If so, you should probably check out this: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/[^] (soon to be a part of the official jquery.ui suite).
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Hi :rose: Shog! :rose:
As per ur reply, I tried in a small html like this
<pre>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>textbox to accept only numbers (digits)</title>
<script type="text/javascript" src="C:\Documents and Settings\Administrator\Desktop\jquery.js"></script>
<script type="text/javascript">
<!--/-+
z`
$.fn.addOption = function(optText, optVal)
{
this.filter("select").each(function()
{
var opt = new Option(optText, optVal);
this.options.add(opt);
});
}
var mapIdToName =
{
1 : "name1",
2 : "name2",
3 : "name3",
4 : "George",
5 : "name5"
};
$(function()
{
$("#textentry").blur(function()
{
var optionVal = $.trim(this.value);
var optionText = mapIdToName[optionVal];
this.value = '';
if ( optionText )
$("#dropdown").addOption(optionText, optionVal);
});
});
</script>
</head>
<form>
<body>
<input type="text" name="name" id="textentry" />
<select id="dropdown">
<option> </option>
</select>
</body>
</form>
</html>
But its not working, please find what is the error?
or else do u think I don't know how to make use of it?
Please explain!!
Thank You
|
|
|
|
|
prnkrish wrote: z`
Not sure what that's doing there, but it won't parse. Always pay attention to your errors...
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
To create web application without the knowledge of programming? Sounds mission impossible.
But with http://www.finereport.com/, it is possible.
On the Excel like workbook, user just need to drag and draw Element (data field, chart, links) to cell, and set the format and editable of the cell, plus the access control, you can turn the template to a web report or a form.
So web application without coding is very possible.
|
|
|
|
|
Don't cross post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
zxn6228 wrote: To create web application without the knowledge of programming? Sounds mission impossible.
But with [spamurl], it is possible.
Yeah, i can't help but notice that the "Live Demo" link doesn't work. Heck, the link to your site doesn't even work. Pretty obvious how well ignorant web dev works then, eh?
Get out of here, spammer. Look somewhere else for suckers.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
ROTFLMAO
Did you check out the forum? There is one posted question on march 10th and no replies! They must be all about the Service!
Hi, do somebody can tell me how to learn the finereport... ??
led mike
|
|
|
|
|
Sorry, FineReport has free version, and we are improving our product and service.
Thanks for your feed back. We corrected the errors.
|
|
|
|
|
Thank you for visiting our web site, and finding out the error. We are not spammer, because we didn't send messages all over the world. We just want to introduce the product to people interested in Excel like web app/reporting.
We will improve our product forever.
|
|
|
|
|