Whatever the container is in (div, table, etc.) use CSS and set overflow: scroll;
For example
<div style="overflow:scroll">This will have a scrollbar</div>
Whatever the container is in (div, table, etc.) use CSS and set overflow: scroll;
For example
<div style="overflow:scroll">This will have a scrollbar</div>
I think I'll stick to the Software Development and Web Development forums but thanks :)
Finally hit 300 posts, and only took a little under 3 years. As a side note I think this is the first time I've ever posted in the Geeks' Lounge.
"SELECT *
FROM `table3`
WHERE name LIKE '%hilgard\'s%'"
var numInputs = 0;
function addInput(){
...
newInput.name = "upload"+parseInt(numInputs);
numInputs++;
...
}
Absolutely, first you click on start then click on your browser (either Firefox, Opera, Safari, IE) Then click the address bar so the text is highlighted. Now press the delete key.
The next step is to type the following text exactly as I have it here w w w . g o o g l e . c o m
In all seriousness, there are thousands of beginning PHP tutorials online, some of the easiest and most concise are at www.w3schools.com
If you are using a server-side language then manipulate the header to send
Cache-Control: no-cache
Pragma: no-cache
This tells the browser to get a fresh copy
IE seems to create a tbody element after <table> so attempting to add the tr to the <table> tag will not work so we have to get the parent element then get the parent of that
function addInput(parentID)
{
newInput = document.createElement('input');
newInput.type = 'file';
newInput.name = 'photo';
var parent = document.getElementById(parentID).parent;
var row = document.createElement('tr');
var td1 = document.createElement('td');
parent.appendChild(row);
row.appendChild(td1);
td1.appendChild(newInput);
}
So no we do something like this
<table>
<tr id='row1'>
<td>
<input type="button" onclick="addInput('rowID')" value="Upload Another" />
</td>
</tr>
</table>
This is a wee bit kludgey but it gets the job done.
I'm not entirely sure what the extra TD is for but this is what it should look like
function addInput(parentID)
{
newInput = document.createElement('input');
newInput.type = 'file';
newInput.name = 'photo';
var parent = document.getElementById(parentID);
var row = document.createElement('tr');
var td1 = document.createElement('td');
parent.appendChild(row);
row.appendChild(td1);
td1.appendChild(newInput);
}
You might want to use a bit more descriptive names. Also, it's not working because you aren't first appending ca (the td) to anything. You must first append the new row (r) to t(parent) then append ca to r, and so on.
whoops, sorry, lowercase d, document.getElementById(parentID).appendChild(newInput);
Absolutely
function addInput(parentID)
{
newInput = document.createElement('input');
newInput.type = 'file';
newInput.name = '<put name you want here>';
document.getElementByID(parentID).appendChild(newInput);
}
So if you have a form such as
<form action="something.php" method="POST" enctype="multipart/form-data" id='imagesForm'>
You would have something along this lines
<input type="button" onclick="addInput('imagesForm')" value="Upload Another" />
Well you could have the function name as the query key and the parameters as the query value IE., test.com/?doThis=param1,param2,param3
Then in PHP
foreach($_GET as $key=>value){
$values = split(",",$value);
$key($values[0],$values[1],$values[2]);
}
Obviously, that's just an example but that's the jist of it. Not to mention that it is a GIGANTIC security gap. Seriously, you could start a country and form a small army inside that thing
Perhaps you haven't seen the large print pretty much everywhere on every forum that says we won't give homework help to those who don't show effort. So show us you've at least attempted it then we will help you.
You can't code anything in HTML but if you are using a server-side language like PHP, ASP, etc. they all have functionality to parse XML files though I've only dealt with PHP XML parsing
This is a batch script I wrote about a year ago to use FFMPEG to convert mpeg or any video format really into flv
@echo off
setlocal
set getdir="%CD%"
set pathto=<put path to ffmpeg here>
cd %pathto%
ffmpeg.exe -i %getdir%\%1 -s 640x480 -ar 44100 -r 25 -sameq %getdir%\%1.flv
cd %getdir%
Used like so
mpegtoflv test.mpeg
You want to validate PHP or validate the page that is generated? You can validate PHP by running the script, if it runs it's valid :)
If you want to validate the page generated then use http://validator.w3.org/
The syntax is irrelevant, if you don't "clean" your inputs then injection will happen, it's an unfortunate inevitability.
If you have a query which you interact with the database such as
SELECT * FROM users WHERE username = 'blah' and password = 'blahblah'
(I have a unhashed password for example purposes)
This would translate into PHP has
$query = "SELECT * FROM users where username = '".$_POST['username']."' AND password = '".$_POST['password']."'";
Which is about as simple as it comes. But, what happens if you don't escape quotes?
Username: bob' OR 1=1 --
We now have the following query
SELECT * FROM users WHERE username = 'bob' OR 1=1 -- this is a comment
Which of course gives the user access no matter what.
SQL Injection is probably your biggest threat with logins since it's pretty simple to defeat brute force attacks with lockout.
addslashes() only goes so far, the same goes for magic_quotes_gpc
I am a Javascript newb, and I am haveing some trouble with my arguments.
while($row=mysql_fetch_array($query)) { echo ' <td class="bar" onmouseover=Javascript:openMenu("' . $row['category'] . '") onmouseout=Javascript:closeMenu("' . $row['category'] . '")> <a href="category.php?cat=' . $row['category'] . '" class="top_menu"><div>' . $row['category'] . '</div></a><div>';
Based on the W3C standards you must encapsulate attribute values in quotes ie, name="hello"
is right, name=hello
is wrong.
So your echo is breaking the script.
echo
"<td class='bar' onmouseover='openMenu(\"".$row['category']."\");'
onmouseout=''closeMenu(\"".$row['category']."\");' >
<a href='category.php?cat=".$row['category']."' class='top_menu'><div>".$row['category']."</div></a><div>\n";
A gif that has the same animation as a video will be MUCH larger. Also, there are no "commands" in HTML, I believe you mean Javascript. So, depending on which video player you use you should be able to get the amount played and the length of the video. You would want to set the window location to something after the amount played is equal to the video length.
<td id="first">
V
<td class="first">
You have the WHERE clauses reversed
$query = "select * from tbl_accounts WHERE $un = email AND $pw = password";
Should be
$query = "select * from tbl_accounts WHERE email = '$un' AND password = '$pw'";
The simplest fib sequence you can write is pretty much
int fib( int n ){return ( n<2 )?n:fib( n-1 )+fib( n-2 );}
Well, firstly all of these things <?php echo $something ?>
can be replaced by <?=$something?>
. Aside from that just create an image with a grey border and nothing else(maybe a white background), call it blank and then make the image src "blank.jpg" or whatever you name it. Changing the class doesn't change the fact that there will be a broken image.
Or you could do something along the lines of
this.setAttribute("onmouseover", "");
this.setAttribute("onmouseout", "");
Put the require after the header, also, you do not need that extremely long list of echoes, this works just as well
<?php
if(Something)
//blah
else
{
?>
<html>
<head><title>Test</title></head>
<body>
Blah
</body>
</html>
<?
}
?>
document.getElementById('states').disabled=false;
That won't work. The selectbox doesn't have an ID, set the ID to states then do the above for it to work.
<listbox>.disabled = false
Yeah, I copied from Vim, and due to laziness haven't changed the tabwidth to 4. Anyway, aside from var sel = frm && frm.elements["selBox"];
being very neat since I haven't seen an inline check for initialization like that before, I figured out the problem. Sending the parent node as an argument was completely unnecessary given that when I was calling it I was just using the child.parentNode anyway (stupid) so instead I'm sending the child as an argument and deriving the parent from that instead of the other way around.
I probably thought removeChild didn't work because of the fact that at one point during development removeChild didn't work in IE but removeNode did *shrug*.
Thanks for that, that really had me stumped.
I've come across a bit of a conundrum. Firefox handles DOM manipulation based on the standard which (would'a'thunk-it?) works. However, Internet Explorer does not. So here's the situation.
I've got a select box and a remove button which, in Firefox, works as advertised, ie., removes the selected element from the list box and destroys the parent if the container optgroup becomes empty using the removeChild()
method. Internet Exploer does not like this method for some reason so I must use the removeNode()
method. This is all well and good except for the fact that when using removeNode()
you may only remove the first child element. For example:
Select Box:
OptGroup 1:
Option 1 <---IE can only remove this element
Option 2 <---Firefox can remove this, IE cannot
End Select Box
So, in essence, my question is: Has anyone found a way, in IE, to be able to remove a random element (and my random I mean not the first child) from a list of child nodes?
This is my current code
function removeSelected(parentElement)
{
if(parentElement.id == null)
parentElement = document.getElementById(parentElement);
for(i=0;i<parentElement.childNodes.length;i++)
{
child = parentElement.childNodes[i];
if(child.seleced)
{
parentElement.removeChild(child);
if(!parentElement.hasChildNodes())
{
try/*standard compliant*/{
parentElement.parentNode.removeChild(parentElement);}
catch/*IE crap*/(ex){
parentElement.parentNode.removeNode(parentElement);{
}
}
else if(child.firstChild.nodeType == Node.ELEMENT_NODE && child.hasChildNodes())
removeSelected(child.firstChild);
}
}
I believe in that situation it implicitly applies the f
In simple terms, yes, it is a float. If you don't include the f I believe, technically, it is considered a double.
Well in the database you would store the page name/page ID as well as the actual page in a largetext or memo field. When the page is requested by name/ID you would simply pull it from the database and display it, ie., <a href="page?id=25018">Read more...</a>
You have to surround it with quotes, it's a string.
$wiseword = '<div class="left-box"><p>'.$quote[$rn]['quote'].'</p><p align="right">'.$quote[$rn]['auth'].'</p></div>';
You're better off writing a short method to remove the box in question like this
function remove(elemID)
{
elem=document.getElementById(elemID);
elem.parentNode.removeNode(elem);
}
You don't have to leave the page since all browsers since about 1998 (>IE5.5) have been able to use DOM manipulation
Then:
<a onclick="remove('someID');">Remove</a>
Well you don't really need to use PHP for that, that is some very simple JavaScript
function addBoxes(numBoxes, parent)
{
for(i=0;i<numBoxes;i++)
{
$tmpbox = document.createElement('input');
$tmpbox.type = "text";
$tmpbox.id = "txt"+i;
parent.appendChild($tmpBox);
}
}
Then in the page just put
<form>
no of textboxes needed to generate dynamically
<input type="text" id="numboxes" name="tboxes" size="50">
<input type="button" name="create" value="Create Inputs"
onclick="addBoxes(document.getElementById('numboxes').value, this.parentNode);">
</form>
If you're using the windows firewall then you would add an exception to port 80, I'm not sure with Norton you could just look at online documentation.
Well you can use your IP address but you'll have to open up port 80 on your firewall and router if applicable. You can also use something like no-ip.org to get a free, albeit temporary, domain.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
There should be a space between the ) and or
Also, use [code=php]
so we can use the line numbers.
As a side note, you might want to obscure your server, password and username given that you just gave every single google user on earth access to it. If a mod is reading this please take that out for him.
Be more descriptive with your error messages
$result=mysql_query($sql) or die(mysql_error());
Take out the semicolons after the Values ie.,
$sql="INSERT INTO $tbl_name(VeteranName, Address, StateProv, ZipCode, Branch, Dateserved, Comments, guestname, Phonenumber, city)
VALUES('$VeteranName',
'$Address',
'$StateProv',
'$ZipCode',
'$Branch',
'$Dateserved',
'$Comments',
'$guestname',
'$Phonenumber',
$city')";
$result=mysql_query($sql);
Also, don't do $VeteranName = $_GET['VeteranName'];
etc.
just do extract($_REQUEST);
I may be wrong but I've never heard of C++ being used for the web. Unless its for some web app DLLs and not server side scripting. C# would be something you'd use, which isn't a variation of C or C++. I've heard from other developers that C# is a Java clone. Anyway C++ can't be used for the web in the sense of PHP, Java or C#.
Many CGI scripts are written entirely in C++.
As for AJAX, you can't use AJAX entirely since there's no real constructs to interact with a database. You'll need some type of server-side language (CGI/PHP/Ruby on Rails/etc.)
.tabbar_homepage li.current a b {
To explain what this is doing we have the first bit .tabbar_homepage
which means that what we're going to be working with is anything with that class applied. Second is li
which tells it any list-item element which that class applied, thirdly we have .current which applies ONLY to list-items within the tabbar_homepage class ie.,
<div class="tabbar_homepage">
<ul><li class="current">blah</li></ul>
</div>
Next, we have a
which will look for an anchor (a) TAG, ie., <a href="hello.html">Hello</a>
. Now keep in mind that that was looking for a TAG, so when we get to the b
bit it is looking for a b TAG ie., <a href="hi.html"><b>Hello</b></a>
So to match that style you would need this:
<!-- I'm using div as a container, doesn't matter what you use -->
<div class="tabbar_homepage">
<ul>
<li class="current"><b><a href="test.html">Test</b></a></li>
</ul>
</div>
So, after all that, we realize that there is no class ab
which is what you were looking for, since it is looking for the b tag inside the a tag.
If you're on linux then grep is your friend. Also as Johnsquibb said, if you have probably over 5 instances of identical code, put it in one file then just include it.
So, I've got a nifty little recursive function that runs through a select box and all it's children looking for the selected element and removes it, if the parent element is empty then it removes that as well. However, the W3C decided when passing DOM that there are 12, count 'em, 12 different node types.
So my function works perfectly well until it tries to do it's job and crawls across an option
node, which as defined by DOM has a nodeType
of 3 (text node). However, the brilliant engineers decided that TEXT NODES should have child nodes which mirror the text attribute, ie.,
<option id="s3">Text is here</option>
DOM:
element.id = "s3"
element.text = "Text is here"
element.childNodes = ["Text is here"]
[0]
nodeType = 3
nodeValue = "Text is here"
This, of course, boggles my mind. So checking nodes for the number of child nodes results in a false positive on option
type nodes causing the function to incorrectly call and put itself into an infinite loop crawling the same node.
I've fixed it by kludging the crap out of it when checking the nodeType as well as the node length but.. wow, how on earth is that even logical?