Search Results

Search found 29484 results on 1180 pages for 'html'.

Page 31/1180 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • PHP loop hanging/interspersed/threaded through HTML

    - by sandyv
    I can't figure out how to say what I'm talking about which is a big part of why I'm stuck. In PHP I often see code like this html <?php language construct that uses brackets { some code; ?> more html <?php some more code; } ?> rest of html Is there any name for this? Having seen this lead me to try it out so here is a concrete example whose behavior doesn't make sense to me <div id="content"> <ul id="nav"> <?php $path = 'content'; $dir = dir($path); while(false !== ($file = $dir->read())) { if(preg_match('/.+\.txt/i', $file)) { echo "<li>$file</li>"; ?> </ul> <?php echo file_get_contents($path . '/' . $file); } } ?> </div> Which outputs roughly <div><ul><li></li></ul><li></li>...</div> instead of <div><ul><li></li>...</ul></div> which is what I thought would happen and what I want to happen.

    Read the article

  • Multiple submits in an HTML form

    - by StackOverflowNewbie
    I have an HTML form that needs multiple submit buttons, like this: <input type="submit" name="foo" value="1"/> <input type="submit" name="foo" value="2"/> <input type="submit" name="foo" value="3"/> The problem is that I want it to display on the button something other than what is in the value attribute (in the example above: 1, 2, 3). For example, I want to show "Bar" for the button with value="1". Is this possible? I've considered using the <button> tag, like this: <button name="foo" value="1">Bar</button> The problem with using <button> (from w3schools): If you use the element in an HTML form, different browsers may submit different values. Internet Explorer, prior version 9, will submit the text between the and tags, while other browsers will submit the content of the value attribute. Use the element to create buttons in an HTML form. Thoughts?

    Read the article

  • HTML+CSS: 'a' width doesn't work

    - by Budda
    I have the following code: CSS part: <style type="text/css"> .menu { width:200px; } .menu ul { list-style-image:none; list-style-type:none; } .menu li { margin:2px; } .menu A { height:25px; width:170px; background:url(./images/button-51.png); padding:2px 5px ; } .menu A:link { height:25px; width:170px; background:url(./images/button-51.png); padding:2px 5px ; } </style> HTML part: Everything work fine, but when I add 'DOCTYPE' element in the beginning of the HTML document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the width of 'a' element is not taken into account. Question 1: Why? Question 2: How to fix that? Thanks a lot!

    Read the article

  • PGU HTML Renderer can't render most sites

    - by None
    I am trying to make a web browser using pygame. I am using PGU for html rendering. It works fine when I visit simple sites, like example.com, but when I try and load anything more complex that uses an html form, like google, I get this error: UnboundLocalError: local variable 'e' referenced before assignment I looked in the PGU html rendering file and found this code segment: def start_input(self,attrs): r = self.attrs_to_map(attrs) params = self.map_to_params(r) #why bother #params = {} type_,name,value = r.get('type','text'),r.get('name',None),r.get('value',None) f = self.form if type_ == 'text': e = gui.Input(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'radio': if name not in f.groups: f.groups[name] = gui.Group(name=name) g = f.groups[name] del params['name'] e = gui.Radio(group=g,**params) self.map_to_connects(e,r) self.item.add(e) if 'checked' in r: g.value = value elif type_ == 'checkbox': if name not in f.groups: f.groups[name] = gui.Group(name=name) g = f.groups[name] del params['name'] e = gui.Checkbox(group=g,**params) self.map_to_connects(e,r) self.item.add(e) if 'checked' in r: g.value = value elif type_ == 'button': e = gui.Button(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'submit': e = gui.Button(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'file': e = gui.Input(**params) self.map_to_connects(e,r) self.item.add(e) b = gui.Button(value='Browse...') self.item.add(b) def _browse(value): d = gui.FileDialog(); d.connect(gui.CHANGE,gui.action_setvalue,(d,e)) d.open(); b.connect(gui.CLICK,_browse,None) self._locals[r.get('id',None)] = e I got the error in the last line, because e wasn't defined. I am guessing the reason for this is that the if statement that checks the type of the input and creates the e variable didn't match anything. I added a line to print the _type variable and I got 'hidden' when i tried google and apple. Is there any way to render form items that have the type 'hidden' with PGU?

    Read the article

  • Whats wrong with my code? (jQuery + HTML)

    - by Art Zeeman
    I'm trying to open a link as soon as you open the page (by forcing a click) with jQuery, but it doesn't work. <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $('a.bla').click(function(){ window.open(this.href); return false; }); }); </script> </head> <body> <a href="url-to-open.php" target="_blank" class='bla'><img src="pic.png" alt="" style="border:none;" /></a> </body> </html> I have no clue what's wrong. I hope someone of you knows how to fix this.

    Read the article

  • How do I pass the value of input fields on one html page to input fields on another html page using dojo

    - by Amen
    I am trying to pass the values of input fields on one html page to another html page that has a form with input fields. How do I write the dojo or JavaScript code to accomplish this? <form id="form1" method="post" action="form2.html"> First Name: <input id="tFName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" /> <br/> <br/> Last Name: <input id="tLName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" /> <br/> <input type='submit' value='Submit'/> </form> here is form 2: <form id="form"> First Name: <input id="tFName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" /> <br/> <br/> Last Name: <input id="tLName" name="tFName" type="text" tabindex="0" iclass="isCompleted" maxlength="50" /> <br/> <input type='submit' value='Save Your Name'/> </form>

    Read the article

  • Change HTML DropDown Default Value with a MySQL value

    - by fzr11017
    I'm working on a profile page, where a registered user can update their information. Because the user has already submitted their information, I would like their information from the database to populate my HTML form. Within PHP, I'm creating the HTML form with the values filled in. However, I've tried creating an IF statement to determine whether an option is selected as the default value. Right now, my website is giving me a default value of the last option, Undeclared. Therefore, I'm not sure if all IF statements are evaluation as true, or if it is simply skipping to selected=selected. Here is my HTML, which is currently embedded with PHP(): <select name="Major"> <option if($row[Major] == Accounting){ selected="selected"}>Accounting</option> <option if($row[Major] == Business Honors Program){ selected="selected"}>Business Honors Program</option> <option if($row[Major] == Engineering Route to Business){ selected="selected"}>Engineering Route to Business</option> <option if($row[Major] == Finance){ selected="selected"}>Finance</option> <option if($row[Major] == International Business){ selected="selected"}>International Business</option> <option if($row[Major] == Management){ selected="selected"}>Management</option> <option if($row[Major] == Management Information Systems){ selected="selected"}>Management Information Systems</option> <option if($row[Major] == Marketing){ selected="selected"}>Marketing</option> <option if($row[Major] == MPA){ selected="selected"}>MPA</option> <option if($row[Major] == Supply Chain Management){ selected="selected"}>Supply Chain Management</option> <option if($row[Major] == Undeclared){ selected="selected"}>Undeclared</option> </select>

    Read the article

  • Using JQuery tabs in an HTML 5 page

    - by nikolaosk
    In this post I will show you how to create a simple tabbed interface using JQuery,HTML 5 and CSS.Make sure you have downloaded the latest version of JQuery (minified version) from http://jquery.com/download.Please find here all my posts regarding JQuery.Also have a look at my posts regarding HTML 5.In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. Let me move on to the actual example.This is the sample HTML 5 page<!DOCTYPE html><html lang="en">  <head>    <title>Liverpool Legends</title>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >    <link rel="stylesheet" type="text/css" href="style.css">    <script type="text/javascript" src="jquery-1.8.2.min.js"> </script>     <script type="text/javascript" src="tabs.js"></script>       </head>  <body>    <header>        <h1>Liverpool Legends</h1>    </header>     <section id="tabs">        <ul>            <li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=9143136#first-tab">Defenders</a></li>            <li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=9143136#second-tab">Midfielders</a></li>            <li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=9143136#third-tab">Strikers</a></li>        </ul>   <div id="first-tab">     <h3>Liverpool Defenders</h3>     <p> The best defenders that played for Liverpool are Jamie Carragher, Sami Hyypia , Ron Yeats and Alan Hansen.</p>   </div>   <div id="second-tab">     <h3>Liverpool Midfielders</h3>     <p> The best midfielders that played for Liverpool are Kenny Dalglish, John Barnes,Ian Callaghan,Steven Gerrard and Jan Molby.        </p>   </div>   <div id="third-tab">     <h3>Liverpool Strikers</h3>     <p>The best strikers that played for Liverpool are Ian Rush,Roger Hunt,Robbie Fowler and Fernando Torres.<br/>      </p>   </div> </div></section>            <footer>        <p>All Rights Reserved</p>      </footer>     </body>  </html>  This is very simple HTML markup. I have styled this markup using CSS.The contents of the style.css file follow* {    margin: 0;    padding: 0;}header{font-family:Tahoma;font-size:1.3em;color:#505050;text-align:center;}#tabs {    font-size: 0.9em;    margin: 20px 0;}#tabs ul {    float: left;    background: #777;    width: 260px;    padding-top: 24px;}#tabs li {    margin-left: 8px;    list-style: none;}* html #tabs li {    display: inline;}#tabs li, #tabs li a {    float: left;}#tabs ul li.active {    border-top:2px red solid;    background: #15ADFF;}#tabs ul li.active a {    color: #333333;}#tabs div {    background: #15ADFF;    clear: both;    padding: 15px;    min-height: 200px;}#tabs div h3 {    margin-bottom: 12px;}#tabs div p {    line-height: 26px;}#tabs ul li a {    text-decoration: none;    padding: 8px;    color:#0b2f20;    font-weight: bold;}footer{background-color:#999;width:100%;text-align:center;font-size:1.1em;color:#002233;}There are some CSS rules that style the various elements in the HTML 5 file. These are straight-forward rules. The JQuery code lives inside the tabs.js file $(document).ready(function(){$('#tabs div').hide();$('#tabs div:first').show();$('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){$('#tabs ul li').removeClass('active');$(this).parent().addClass('active');var currentTab = $(this).attr('href');$('#tabs div').hide();$(currentTab).show();return false;});}); I am using some of the most commonly used JQuery functions like hide , show, addclass , removeClass I hide and show the tabs when the tab becomes the active tab. When I view my page I get the following result Hope it helps!!!!!

    Read the article

  • HTML: Place an image on top of another one

    - by Dimitris Baltas
    Inside a div, there is a picture that should have 10px margin in all directions from the DIV's border. On the left bottom corner of the picture there is an about-image. The picture is only displayed when its loaded in the DOM through jquery. The problem is that the existence of the about-image dislocates the picture downwards as many pixels as the height of the about-image. I am looking for the cleanest possible alternative to keep the picture inside the DIV and still display the about-image on top of it. Setting the picture as background will not work since i need the picture to load at once. Any improvement on the #about css would be greatly appreciated. Below is a full html page that reproduces the issue <html> <head> <title>Troubleshooting :: align the main picture inside the DIV</title> <style type="text/css"> html, body { background-color: #000000; } #about { z-index:2; position:relative; top:82%; left:3%; } #pic { width:100%; height:96%; } #main-content-image { height:100%; margin-right:10px; margin-left:10px; margin-top:10px; margin-bottom:10px; } #main-content { height:490px; border-width: 1px; border-style: solid; border-color: #777777; } #main-content-image.loading { background: url(http://farros.gr/images/ajax-loader2.gif) no-repeat center center; } a { text-decoration: none; text-decoration: none; color: #868686; outline:none; } .hide { display:none; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> <!-- $(document).ready(function(){ $(function () { var img = new Image(); $(img).load(function () { $(this).hide(); $(this).width('100%'); $(this).height('96%'); $('#main-content-image').removeClass('loading').append(this); $(this).fadeIn(); }).error(function () { // notify the user that the image could not be loaded }).attr('src', 'http://farros.gr/images/bg.jpg'); }); }); </script> </head> <body> <div id="main-content"> <div id="main-content-image" class="loading"> <a href="#"><img id="about" src='http://farros.gr/images/about.png' alt='Haris Farros'/></a> </div> </div> </body> </html>

    Read the article

  • Div in HTML not floating left with CSS

    - by rusty009
    My div with class name 'header-body-right' doesn't seem to be floating to the left of my div named 'header-body-centre' and I can't understand why, here is my HTML, <!DOCTYPE HTML> <HTML> <HEAD> <TITLE> </TITLE> <meta charset="UTF-8" /> <link href="main.css" rel="stylesheet" type="text/css"> <META NAME="Generator" CONTENT="Notepad"> <META NAME="Author" CONTENT="00"> <META NAME="KEYWORDS" CONTENT="" /> <META NAME="DESCRIPTION" CONTENT="" /> </HEAD> <BODY> <div class="header-top"> </div> <div class="header-body"> <div class="header-body-centre"> <div class="logo"> <img src="logo.png" /> </div> </div> <div class="header-body-right"> test </div> </div> <div class="navbar"> </div> <div class="content-container"> </div> </BODY> </HTML> The CSS I am using for the code is posted below, body { margin:0px; padding:0px; } .header-top { height:11px; width:100%; background-image: url('HeaderTopNav.png'); background-repeat: repeat-x; } .header-body { width:100%; height:100px; } .header-body-centre { margin: 0 auto; height:100%; width:70%; } .header-body-right { width:15%; height:100px; float:left; } .navbar { height:35px; width:auto; border: 1px solid green; } .logo { margin-top:35px; float:left; } .quickNav { float:right; } .container { margin: 0 auto; background-color: #fff; border: 2px solid #c9c8c8; border-bottom: none; height:auto; overflow:hidden; width: 1000px; clear:both; } Can anyone see why? I have tried floating the header-bosy-centre and decreasing the width of the header-body-right but nothing works. Can anyone see what I have done wrong? I am out of ideas. Thanks.

    Read the article

  • Setting html attribute that is reserved keyword in Html.CheckBoxFor in ASP.NET MVC

    - by dormisher
    Hi, I am using the HtmlHelper to create a checkbox in my view like so: <%= Html.CheckBoxFor(model = model.SeatOnly, new { checked = "checked" })% However, an error is being thrown as checked is a reserved keyword. I have found a couple of people saying that you must use the 'reserved word prefix' and simply put an uderscore in front of the attribute like so: <%= Html.CheckBoxFor(model = model.SeatOnly, new { _checked = "checked" })% This does not generate an error but in the generated html the attribute is actually '_checked' which means it doesn't work (if I use firebug and remove the underscore the attribute then takes effect). Does anyone know a way around this while still using CheckBoxFor? Thanks

    Read the article

  • please help me to add the html fields in the following link [closed]

    - by user237389
    Link Name: http://business.careerbuilderinstitute.com/testportal/webservices/iscapi.asmx/CreateUser html code register.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Web-Service User Registration Form</title> </head> <body> <b style="font-size:20px; color:#3366CC">CreateUser</b><br/><br/> Create a user account. User may be assigned to a particular hierarchy level.<br/><br/> <b>Test</b><br/><br/> To test the operation using the HTTP POST protocol, click the 'Invoke' button. <form action="http://business.careerbuilderinstitute.com/testportal/webservices/iscapi.asmx/CreateUser" method="POST"/> <table width="542" border="0" style="margin-left:25px;"> <tr> <th width="172" style="background-color:#c0c0c0;">Parameter</th> <th width="360" style="background-color:#c0c0c0;">Value</th> </tr> <tr> <input name="authorizationId" type="text" value="TestService" size="60" /> </tr> <tr> <input name="passcode" type="hidden" value="welcome" size="60"/> </tr> <tr> <input name="organizationId" type="hidden" value="27" size="60"/> </tr> <tr> <input name="globalUniqueId" type="hidden" value="GUID" size="60"/> </tr> <tr> <input name="hierarchyID" type="hidden" value="0" size="60"/> </tr> <tr> <input name="hireDate" type="hidden" value="1" size="60"/> </tr> <tr> <input name="studentProfileId" type="hidden" value="0" size="60"/> </tr> <tr> <input name="alternateId" type="hidden" value="0" size="60"/> </tr> <tr> <input name="alternateId2" type="hidden" value="0" size="60"/> </tr> <tr> <input name="alternateId3" type="hidden" value="0" size="60"/> </tr> <tr> <input name="ssn" type="hidden" value="0" size="60"/> </tr> <tr> <input name="license" type="hidden" value="0" size="60"/> </tr> <tr> <input name="comments" type="hidden" value="0" size="60"/> </tr> <tr> <input name="clientDrive" type="hidden" value="0" size="60"/> </tr> <tr> <input name="nickname" type="hidden" value="0" size="60"/> </tr> <tr> <input name="photoIcon" type="hidden" value="0" size="60"/> </tr> <tr> <input name="cellPhone" type="hidden" value="0" size="60"/> </tr> <tr> <input name="blogUniformResourceLocator" type="hidden" value="0" size="60"/> </tr> <tr> <input name="userResume" type="hidden" value="0" size="60"/> </tr> <tr> <input name="resumeAttach" type="hidden" value="0" size="60"/> </tr> <tr> <input name="education" type="hidden" value="0" size="60"/> </tr> <tr> <input name="experience" type="hidden" value="0" size="60"/> </tr> <tr> <input name="reflections" type="hidden" value="0" size="60"/> </tr> <tr> <input name="storeFrontID" type="hidden" value="0" size="60"/> </tr> <!-- <tr> <input name="resumeAttach" type="hidden" value="0" size="60"/> </tr> --> <tr> <input name="siteadministrator" type="hidden" value="0" size="60" /> </tr> <tr> <input name="instructor" type="hidden" value="0" size="60" /> </tr> <tr> <input name="student" type="hidden" value="1" size="60" /> </tr> <tr> <input name="supervisor" type="hidden" value="0" size="60"/> </tr> <!-- "This field should be passed in the URL with Account did" <tr> <input name="hierarchyID" type="hidden" value="0" size="60"/> </tr> "This field is not required" <tr> <input name="studentProfileId" type="hidden" value="" /> </tr> <tr> --> </tr> <tr> <th scope="row" align="left">firstName:</th> <td><input name="firstName" type="text" size="60" id="firstName"/></td> </tr> <tr> <th scope="row" align="left">lastName:</th> <td><input name="lastName" type="text" size="60"/></td> </tr> <tr> <th scope="row" align="left">userName:</th> <td><input name="userName" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">password:</th> <td><input name="password" type="password" size="60" /></td> </tr> <tr> <th scope="row" align="left">email:</th> <td><input name="email" type="text" size="60" /></td> </tr> <tr> </tr> <tr> <th scope="row" align="left">organization:</th> <td><input name="organization" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">jobTitle:</th> <td><input name="jobTitle" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">department:</th> <td><input name="department" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">location:</th> <td><input name="location" type="text" size="60" /></td> </tr> <th scope="row" align="left">phone:</th> <td><input name="phone" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">fax:</th> <td><input name="fax" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">address:</th> <td><input name="address" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">address2:</th> <td><input name="address2" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">city:</th> <td><input name="city" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">state:</th> <td><input name="state" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">country:</th> <td><input name="country" type="text" size="60" /></td> </tr> <tr> <th scope="row" align="left">zip:</th> <td><input name="zip" type="text" size="60" /></td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <input name="languagePreference" type="hidden" value="1" size="60" /> </tr> <tr> <input name="active" type="hidden" value="1" size="60" /> </tr> <tr> <th scope="row" align="left"></th> <td><input name="Invoke" type="submit" value="Invoke" /></td> </tr> </table> </form> </body> </html>

    Read the article

  • PHP combobox can't save the selected value on Edit Page

    - by bEtTy Barnes
    hello I've got problem with my combobox. It's not saving the selected value in Edit page. Here what I'm working with: private function inputCAR(){ $html = ""; $selectedId = $this->CAR; //$html .= '<option value="Roadmap Accelerator - Core">Roadmap Accelerator - Core</option>'; //$html .= '<option value="Roadmap Accelerator - Optional Core">Roadmap Accelerator - Optional Core</option>'; //$html .= '<option value="Regulatory">Regulatory</option>'; //$html .= '<option value="Mission Critical">Mission Critical</option>'; //$html .= '<option value="Various CARs/Types">Various CARs/types</option>'; $selection = array( "Roadmap Accelerator - Core", "Roadmap Accelerator - Optional Core", "Regulatory", "Mission Critical", "Various CARs/types" ); $html .= '<label for="car">CAR Type</label>'; $html .= HTML::selectStart("car"); foreach($selection as $value){ $text = $value; $html .= HTML::option($value, $text, $selectedId == $value ? true : false); } $html .= HTML::selectEnd(); return $html; } My option function: public static function option($value, $text, $isSelected=false) { $html = '<option value="' . $value . '"'; if($isSelected) { $html .= ' selected="selected"'; } $html .= '>'; $html .= $text; $html .= '</option>'; return $html; } When I first created a record. The selected value from my combobox got saved into the DB then the page refreshed to display. When I went to edit page, to select another value, and clicked save button. On the display page, it's not saving. For example. on Create page I selected Regulatory. then I changed my mind and changed it to Mission Critical on Edit page. On display page it is not changed. I don't know what's wrong or what I'm missing here. Any help is welcome and truly appreciated. Thanks.

    Read the article

  • Select all text in an <input /> when it gains focus

    - by Chris Barr
    I've got a textbox (set to readonly) and I need its' contents to be selected for easy copy/paste when it gains focus. Using the code below it only seems to quickly select the text and then unselect it for some reason. HTML <input id='thing' type='text' value='some text' readonly='readonly' />? JavaScript document.getElementById('thing').onfocus = function(){ this.select(); };? Fiddle: http://jsfiddle.net/cfqje/

    Read the article

  • Scrolling an HTML 5 page using JQuery

    - by nikolaosk
    In this post I will show you how to use JQuery to scroll through an HTML 5 page.I had to help a friend of mine to implement this functionality and I thought it would be a good idea to write a post.I will not use any JQuery scrollbar plugin,I will just use the very popular JQuery Library. Please download the library (minified version) from http://jquery.com/download.Please find here all my posts regarding JQuery.Also have a look at my posts regarding HTML 5.In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. Let me move on to the actual example.This is the sample HTML 5 page<!DOCTYPE html><html lang="en">  <head>    <title>Liverpool Legends</title>        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >        <link rel="stylesheet" type="text/css" href="style.css">        <script type="text/javascript" src="jquery-1.8.2.min.js"> </script>     <script type="text/javascript" src="scroll.js">     </script>       </head>  <body>    <header>        <h1>Liverpool Legends</h1>    </header>        <div id="main">        <table>        <caption>Liverpool Players</caption>        <thead>            <tr>                <th>Name</th>                <th>Photo</th>                <th>Position</th>                <th>Age</th>                <th>Scroll</th>            </tr>        </thead>        <tfoot class="footnote">            <tr>                <td colspan="4">We will add more photos soon</td>            </tr>        </tfoot>    <tbody>        <tr class="maintop">        <td>Alan Hansen</td>            <td>            <figure>            <img src="images\Alan-hansen-large.jpg" alt="Alan Hansen">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/Alan_Hansen">Alan Hansen</a></figcaption>            </figure>            </td>            <td>Defender</td>            <td>57</td>            <td class="top">Middle</td>        </tr>        <tr>        <td>Graeme Souness</td>            <td>            <figure>            <img src="images\graeme-souness-large.jpg" alt="Graeme Souness">            <figcaption>Souness was the captain of the successful Liverpool team of the early 1980s <a href="http://en.wikipedia.org/wiki/Graeme_Souness">Graeme Souness</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>59</td>        </tr>        <tr>        <td>Ian Rush</td>            <td>            <figure>            <img src="images\ian-rush-large.jpg" alt="Ian Rush">            <figcaption>The deadliest Liverpool Striker <a href="http://it.wikipedia.org/wiki/Ian_Rush">Ian Rush</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>51</td>        </tr>        <tr class="mainmiddle">        <td>John Barnes</td>            <td>            <figure>            <img src="images\john-barnes-large.jpg" alt="John Barnes">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/John_Barnes_(footballer)">John Barnes</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>49</td>            <td class="middle">Bottom</td>        </tr>                <tr>        <td>Kenny Dalglish</td>            <td>            <figure>            <img src="images\kenny-dalglish-large.jpg" alt="Kenny Dalglish">            <figcaption>King Kenny <a href="http://en.wikipedia.org/wiki/Kenny_Dalglish">Kenny Dalglish</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>61</td>        </tr>        <tr>            <td>Michael Owen</td>            <td>            <figure>            <img src="images\michael-owen-large.jpg" alt="Michael Owen">            <figcaption>Michael was Liverpool's top goal scorer from 1997–2004 <a href="http://www.michaelowen.com/">Michael Owen</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>33</td>        </tr>        <tr>            <td>Robbie Fowler</td>            <td>            <figure>            <img src="images\robbie-fowler-large.jpg" alt="Robbie Fowler">            <figcaption>Fowler scored 183 goals in total for Liverpool <a href="http://en.wikipedia.org/wiki/Robbie_Fowler">Robbie Fowler</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>38</td>        </tr>        <tr class="mainbottom">            <td>Steven Gerrard</td>            <td>            <figure>            <img src="images\steven-gerrard-large.jpg" alt="Steven Gerrard">            <figcaption>Liverpool's captain <a href="http://en.wikipedia.org/wiki/Steven_Gerrard">Steven Gerrard</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>32</td>            <td class="bottom">Top</td>        </tr>    </tbody></table>          </div>            <footer>        <p>All Rights Reserved</p>      </footer>     </body>  </html>  The markup is very easy to follow and understand. You do not have to type all the code,simply copy and paste it.For those that you are not familiar with HTML 5, please take a closer look at the new tags/elements introduced with HTML 5.When I view the HTML 5 page with Firefox I see the following result. I have also an external stylesheet (style.css). body{background-color:#efefef;}h1{font-size:2.3em;}table { border-collapse: collapse;font-family: Futura, Arial, sans-serif; }caption { font-size: 1.2em; margin: 1em auto; }th, td {padding: .65em; }th, thead { background: #000; color: #fff; border: 1px solid #000; }tr:nth-child(odd) { background: #ccc; }tr:nth-child(even) { background: #404040; }td { border-right: 1px solid #777; }table { border: 1px solid #777;  }.top, .middle, .bottom {    cursor: pointer;    font-size: 22px;    font-weight: bold;    text-align: center;}.footnote{text-align:center;font-family:Tahoma;color:#EB7515;}a{color:#22577a;text-decoration:none;}     a:hover {color:#125949; text-decoration:none;}  footer{background-color:#505050;width:1150px;}These are just simple CSS Rules that style the various HTML 5 tags,classes. The jQuery code that makes it all possible resides inside the scroll.js file.Make sure you type everything correctly.$(document).ready(function() {                 $('.top').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainmiddle").offset().top                     },4000 );                  });                 $('.middle').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainbottom").offset().top                     },4000);                  });                     $('.bottom').click(function(){                     $('html, body').animate({                         scrollTop: $(".maintop").offset().top                     },4000);                  }); });  Let me explain what I am doing here.When I click on the Middle word (  $('.top').click(function(){ ) this relates to the top class that is clicked.Then we declare the elements that we want to participate in the scrolling. In this case is html,body ( $('html, body').animate).These elements will be part of the vertical scrolling.In the next line of code we simply move (navigate) to the element (class mainmiddle that is attached to a tr element.)      scrollTop: $(".mainmiddle").offset().top  Make sure you type all the code correctly and try it for yourself. I have tested this solution will all 4-5 major browsers.Hope it helps!!!

    Read the article

  • Simple libxml2 HTML parsing example, using Objective-c, Xcode, and HTMLparser.h

    - by Stu
    Please can somebody show me a simple example of parsing some HTML using libxml. #import <libxml2/libxml/HTMLparser.h> NSString *html = @"<ul><li><input type=\"image\" name=\"input1\" value=\"string1value\" /></li><li><input type=\"image\" name=\"input2\" value=\"string2value\" /></li></ul><span class=\"spantext\"><b>Hello World 1</b></span><span class=\"spantext\"><b>Hello World 2</b></span>"; 1) Say I want to parse the value of the input whose name = input2. Should output "string2value". 2) Say I want to parse the inner contents of each span tag whose class = spantext. Should output: "Hello World 1" and "Hello World 2".

    Read the article

  • Boolean with html helper Hidden and HiddenFor

    - by Martin
    What's up with this? The viewmodel variable is a bool with value true. <%= Html.HiddenFor(m => m.TheBool) %> <%= Html.Hidden("IsTimeExpanded",Model.TheBool) %> <input type="hidden" value="<%=Model.TheBool%>" name="TheBool" id="TheBool"> Results in: <input id="TheBool" name="TheBool" value="False" type="hidden"> <input id="TheBool" name="TheBool" value="False" type="hidden"> <input value="True" name="TheBool" id="TheBool" type="hidden"> What am I doing wrong? Why don't the helpers work as intended?

    Read the article

  • asp.net RenderControl and html

    - by kusanagi
    i use such code protected override void Render(System.Web.UI.HtmlTextWriter writer) { writer.AddAttribute("class", "dd0"); if (!String.IsNullOrEmpty(this.LiLeftMargin)) { writer.AddAttribute("style", string.Format("margin-left: {0}px", this.LiLeftMargin)); } writer.RenderBeginTag("li"); writer.AddAttribute("id", "dt1"); writer.RenderBeginTag("div"); writer.AddAttribute("class", "ddlink"); this.HyperLink.RenderControl(writer);//i wand that render html <b>name</b> writer.RenderEndTag(); writer.RenderEndTag(); } my HyperLink name contain html tags, like <b>name</b> but it render like this &lt;B&gt;name how can i make text bold (tagn not ekraned)

    Read the article

  • Objective C HTML escape/unescape

    - by Squeegy
    Wondering if there is an easy way to do a simple HTML escape/unescape in Objective C. What I want is something like this psuedo code: NSString *string = @"&lt;span&gt;Foo&lt;/span&gt;"; [string stringByUnescapingHTML]; Which returns <span>Foo</span> Hopefully unescaping all other HTML entities as well and even ASCII codes like Ӓ and the like. Is there any methods in Cocoa Touch/UIKit to do this?

    Read the article

  • Rails remove parent HTML tag

    - by gshankar
    It's pretty easy to sanitize HTML and strip ALL instances of a HTML tag using Rails helpers... But how do you just remove ONE tag? In this case, I'm using a WYSIWYG editor that insists on wrapping all my text in a <p> tag. I want to remove this parent tag without stripping out any other <p> tags within the content of the text. I know I could do this in JQuery really easily but I feel like this should be done server-side in my controller before I save the text. Is there a way to do this?

    Read the article

  • ITextSharp HTML to PDF?

    - by Kyle
    I posted a question here a few weeks ago asking about an alternative to creating .fdf files to fill in pdf documents and someone here pointed me to ITextSharp. It's working like a champ so thanks for that. I'd now like to know if ITextSharp has the capability of converting HTML to PDF. Everything I will convert will just be plain text but unfortunately there is very little to no documentation on ITextSharp so I can't determine if that will be a viable solution for me. If it can't do it, can someone point me to some good, free .net libraries that can take a simple plain text HTML document and convert it to a pdf? tia.

    Read the article

  • Copying Pasting Word 2007 docs to HTML WYSIWYG editors

    - by Graham
    Microsoft word has a ton of proprietary formatting and styles that do not translate well to html WYSIWYG editors. When you paste them over to the html editor and try to edit the pasted info it causes all kinds of clashing styles. I want to be able to keep the general structure but leave out the proprietary stuff. Essentially I want to save clients the headache of having to completely strip out all formatting forcing them to redo all the styling again in the WYSIWYG, but at the same time avoid the conflicts that Word formatting creates. Any ideas?

    Read the article

  • Java HTML Parsing

    - by Richie_W
    Hello everyone. I'm working on an app which scrapes data from a website and I was wondering how I should go about getting the data. Specifically I need data contained in a number of div tags which use a specific CSS class - Currently (for testing purposes) I'm just checking for "div class = "classname"" in each line of HTML - This works, but I can't help but feel there is a better solution out there. Ie. - Is there any nice way where I could give a class a line of HTML and have some nice methods like: boolean usesClass(String CSSClassname); String getText(); String getLink(); Many many thanks!

    Read the article

  • Ignore whitespace in HTML

    - by IP
    Is there anything in HTML/CSS that tells the browser to ignore whitespace completely? So many times when you want to put, say, two images next to each other - you try desperately to keep the HTML readable, but the browser puts a space between them. So instead of something like this: <imc src="images/minithing.jpg" alt="my mini thing" /> <imc src="images/minithing.jpg" alt="my mini thing" /> <imc src="images/minithing.jpg" alt="my mini thing" /> <imc src="images/minithing.jpg" alt="my mini thing" /> you end up with this <imc src="images/minithing.jpg" alt="my mini thing" /><imc src="images/minithing.jpg" alt="my mini thing" /><imc src="images/minithing.jpg" alt="my mini thing" /><imc src="images/minithing.jpg" alt="my mini thing" /> Which is just so horrible!

    Read the article

  • Java HTML parser/validator

    - by at
    We allow people to enter HTML code on our wiki-like site. But only a limited subset of HTML to not affect our styling and not allow malicious javascript code. Is there a good Java library on the server side to ensure that the code entered is valid? We tried creating an XML Schema document to validate against. The only issue there is the libraries we used to validate gave back cryptic error messages. What I want is for the validation library to actually fix the issue (if there was a style="" attribute added to an element, remove it). If fixing it is not easy, at least allow me to report a message to the user with the location of the error (an error code that I can present a nice message from is fine, probably even preferable).

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >