html

in_array() not working

My code: <?php $pass = "12345"; //checkPass($pass, $user, $length); $file = file_get_contents("common.txt"); $array = explode("\n", $file); if(in_array($pass, $array) == true) { echo "it's in the array"; } ?> first few lines of the array (i used print_r($array)...): Array ( [0] => 12345 [1] => abc123 [2] => password [3] => comput...

CSS: force image width and height without stretching

If I have: #logo { width: 400px; height: 200px; } then <img id="logo" src="logo.jpg"/> will stretch to fill that space. I want the image to stay the same size, but for it to take up that much space in the DOM. Do I have to add an encapsulating <div> or <span>? I hate adding markup for styling. ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for the web? I mean, with a predefined list of widgets that can be defined using a markup language and then control them using code? I have c...

Differentiating between P tags wrapping images and P tags wrapping text nodes in Wordpress?

Hey all, I need a good solution to be able to style <p> tags differently in a wordpress post. More specifically I need to differentiate between paragraphs and images. Wordpress just wraps all new lines in <P> tags. Here are some possibilities: Strip all <p> tags and add <P> tags where appropriate (around text) Add a class on <P> tags...

Image generator

Hi, I'd like to be able to generate an image with overlaying text (that is inputted by the user) such as how it is done on www.depressiondog.info. Can someone show/link me to some code that will do that. Thanks. ...

Setting the default value in Struts2

Hi all, I am setting the value(kind of default value) for a drop down select value from action class in a page(given below). When the page loads the value is beig displayed but the other elements of the dropdown list is not displayed. here is the code. Inside the action class if(getTypeId() == null){ String typeId = request.getPa...

ajax login using httpRequest?

Hi, I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn't correct a div box will show saying its wrong, if its correct it will show its valid and re-direct to a members page. Would this be secure sending it to a php script..checking with the database, then the php script ...

How to show file path in <input type="file" />?

I tried <input type="file" value="path..." /> but not working. How to fix? ...

special characters wont be inserted into mysql table the right way...

I have a mysql database which Im trying to submit values to through a php file from a form. If I manually insert values to the table 'myTable' with special characters like the swedish åäö letters, it works fine. But when I am trying to use 'INSERT INTO' after a form is submitted on my page, to insert values to the table, all special ch...

Proper entity types for XHTML, XML and inside inline JavaScript

First, the way I understand it, it's more appropriate to use numeric entities in an XHTML document, such as &#034; instead of &quot;, is that right? Second, for my RSS XML feed, which entity type is correct? Named or numeric? I believe it's numeric, but see examples of both in my searches. Third, which of the following is correct for e...

Is ./path neccesary?

<link rel="icon" href="./favicon.ico" type="image/x-icon" /> The above is what I see in index.php of phpMyAdmin. Isn't it the same as: <link rel="icon" href="favicon.ico" type="image/x-icon" /> Or say,can you give an example where these two generates different results? ...

would it be faster to implement php code into html, or to use only php? See more details...

Im currently using PHP to fetch results from a mysql db. Im also displaying the results by building a table and all with PHP also. My question is, would it improve loading speed if I would just call the php variables from a HTML document (PHP + HTML). Or maybe it doesn't matter, and I should go with the ONLY PHP solution that I alread...

Is there a way to create a full width horizontal navigation without using a table?

I have a horizontal navigation with variable width 'buttons'. I would like the navigation to span the entire width of the containing div. I was able to accomplish this if I put the navigation in a table. You can check out this example. The table cells will resize according to how many there are and the width of the text inside them. Can...

HTML anchor replace with RegEx

I have HTML data which I'll be using in a client app. I need to Regex.Replace the <a> tags from <a href="Bahai.aspx">Bahai</a> to <a href="#" onclick="process('Bahai.aspx');return false;">Bahai</a> In C# using RegExReplace with a regex similar to <a[^>]*? href=\"(?<url>[^\"]+)\"[^>]*?>(?<text>.*?)</a> Ideas? ...

Image rendered with wrong colors in IE8

I have a gradient image as a PNG (no transparency) in a web-page. By taking a screenshot of Chrome showing the page and cropping the image from the page, I see the exact same colors are drawn as the image contains... put the screenshot next to the image in Paint and they are identical. But when I do the same with the page rendered in IE...

changing content of a div with javascript and php include

Hello. I wish to do something iframe-like with my div i've got going here. Basically, i've gotten as far as making links change the content of the div like so: <a href="#self" onClick="document.getElementById('maincontent').innerHTML = '<?php include 'file.php'; ?>';">Open file</a> This works pretty well, sadly though, if i make ano...

Can I add custom attribute to html tag?

like this: <tag myAttri="myVal" /> ...

How might I simulate a backspace action in a text field?

When a button is pressed, I simply want to simulate a "backspace" in a regular text box, deleting the character to the left of the cursor. Google and various forums are producing really random results on this. What's the proper way to do this? ...

How to build a simple CSS layout that expands to the viewport?

I am trying to build this very simple (visually speaking) layout using HTML/CSS that you can see in the wire frame below: /------------------------------------------\ | | | header div | | | |-----------------------------------...

Get a deactivated scrollbar in Firefox

I have a Javascript tabbed dialog whose pages have different heights. Some of them are taller than the browser window. In Internet Explorer, there is always a scrollbar to the right. When it is not needed, it is greyed out. The page dimensions stay the same and there is no problem. In Firefox, the Scrollbar is hidden completely when no...