I understand how to generate objects from the database, using Sinatra with formatting, and I understand from tutorials how to use POST to send information back, but I don't understand how to use POST to transfer information from the browser (for instance from a text field, or inside <p id="stufftotransfer"><%= @stuff.each do || stuff.name %></p>) back to the database and store it to show it's working. Basically in Sinatra, if you want to display something as output you do something like this -> application_controller.rb get '/items' do erb :items #for example end #Actually this is items.erb for instance. I can't …

Member Avatar
Member Avatar
+0 forum 1

**I have tried 1st, 2nd points are working good just have to solve 3rd issue:** **1.** Title with bold: "THIS IS MY MAIN TITLE IN CAPS" (title not always same) **2.** Words with bold: TEST ABC:, TEST XYZ:, TES T TEST:, TESTXXX: (this words are always same) **3.** Some strings are not showing skipping a line when you run this code (lessthen and graterthen in string forex: <140/90 mmHg OR <130/80 mmHg). <?php $data = 'THE CORRECT ANSWER IS C. <p>Choice A Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys …

Member Avatar
Member Avatar
+0 forum 1

forexample I can go to [Click Here](http://www.msn.com/) and open developer tools and write this code `document.querySelector('.news a').click()` and it will open news. Now I want a program to do this automatically for me. write a javascript code that do this for me actully this was just a simple example I don't want a program to open news in msn actully I want to submit something automaticaly. 1)how can I do this (I know if want to make this app for desktop I should use something like appjs)? 2)Is there any way that it doesn't open browser and submit that?

Member Avatar
Member Avatar
+0 forum 3

for example I have this html code: <select id="mySelect"> <option value="0">apple</option> <option value="1">orange</option> <option value="2">banana</option> <option value="3">tomato</option> </select> 1-how can I select ` <option value="2">banana</option> ` (by passing the value attribute to selector function)then click on it with javascript with out using jquery 2-Is there any way to select this just by passing `apple` to selector function with out passing the value?

Member Avatar
Member Avatar
+0 forum 2

I having a problem with the cloneNode tag problem. NodeList movielist = doc.getElementsByTagName("movie"); Element child = (Element)movielist.item(6); Element newNode = (Element)child.cloneNode(true); child.appendChild(newNode); newNode.setAttribute("id", "this is newnode"); code above will clone the whole set of thing. but the problem is it colne in wrong tag. i want some thing like this in my xml file. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <movies> <movie id="1007"> <title>Interstellar</title> <genre>Science Fiction</genre> <duration>180 mins</duration> </movie> <movie id="this is newnode"> <title>Interstellar</title> <genre>Science Fiction</genre> <duration>180 mins</duration> </movie> </movies> but the code above give me something like this <?xml version="1.0" encoding="UTF-8" standalone="no"?> <movies> <movie id="1007"> <title>Interstellar</title> <genre>Science Fiction</genre> <duration>180 mins</duration> <movie …

Member Avatar
Member Avatar
+0 forum 9

<table class="filetable" id="filetable"> <thead> <tr> <th width="25%">名称</th> <th width="6%">大小</th> <th width="10%">类型</th> <th width="19%">修改日期</th> <th width="40%"></th> </tr> </thead> <tbody id="FileList" runat="server"> <tr> <td><img src="images/f01.png" />Adobe Dreamweaver CS5简体中文绿色</td> <td>2013/10/14 17:38</td> <td>文件夹</td> <td class="tdlast">0 KB</td> <td></td> </tr> </tbody> </table> this is a table, I want to get the value of each FileName when double click coresponding item. I write script as follow: <script> function Test() { var rows = document.getElementById("filetable").rows; if (rows.length > 0) { for (var i = 1; i < rows.length; i++) { (function (i) { var temp = rows[i].cells[0].childNodes[1]; var obj = rows[i]; obj.ondblclick = function () { alert(temp); }; …

Member Avatar
Member Avatar
+0 forum 4

Hey guys, this seems to be a thorn in my side. I've been working on scraping a website which uses aspx and has eventvalidation/viewstate inputs. Every other scraping experiment I've made was not this difficult. Maybe one of you geniuses here at Daniweb has an idea of how to solve this? I've managed to get Selenium/PHPUnit to automate the process of opening the browser, typing in the URL, filling out the required fields (todays date), and then landing on the page I need to scrape and can get the viewstate and eventvalidation values from any of those pages. I've been …

Member Avatar
Member Avatar
+0 forum 2

Dajia hao, daniwebians! Just a quick question, is it possible to focus on a textbox on an externally loaded website? My goal is to load an external website, focus on a textfield, auto fill it with the current date, then submit it to then run my newly created scraper tool on the resulting page. Any ideas? I've done a bit of research and will continue to do so...

Member Avatar
Member Avatar
+0 forum 9

Hi Friends, Working with communication between a child javascript window and parent jsp function, I am trying to access a function defined in the parent jsp from its child window which is a separate js file. This logic works fine in IE, but breaks in Chrome. * Parent function: multiCreateCallback() * Child JS code to access multiCreateCallback [CODE] var windowCmp = parent.Ext.getCmp('workflowTaskWindow'); var frameVar = windowCmp.getEl().dom.getElementsByTagName("iframe")[0]; console.log("Frame test: "+ frameVar.contentDocument.frames.multiCreateCallback()); [/CODE] No matter what combination I use with frameVar, I can't seem to reach the callback function. 'contentDocument.frames' says undefined 'contentWindow.document.multiCreateCloseCallback()' also gives 'undefined' as error. 'parent.multiCreateCloseCallback();' - gave the …

Member Avatar
Member Avatar
+0 forum 4

in this table how to extract table data and mainly get value after the <b> tag like email id, tel, address <table width="100%" cellspacing="0" cellpadding="10" border="0" class="text"> <tbody> <tr valign="top" onmouseout="this.className = 'pa-nor'" onmouseover="this.className = 'pa-row-highlight'" class="pa-nor"> <td width="50%"> <span class="text1"> School name</span><br> <font color="#cococo"><i>Secondary School</i></font><br> <b>Principal Name:</b> kannan<br> <b>Name of Trust:</b> school Trust </td> <td width="50%"> <b>Address:</b> school address...<br> <b>Pin Code: </b>123456<br> <b>Tel: </b>963852<br> <b>Email:</b> sample@yahoo.co.in </td> </tr> </tbody> </table>

Member Avatar
Member Avatar
+0 forum 3

**this table dont have a id,class, i want get the content** <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td width="14%" height="25">FullName:</td> <td width="86%">kannan</td> </tr> <tr> <td height="25">email</td> <td>kanna@sample.com</td> </tr> </tbody> </table>

Member Avatar
Member Avatar
+0 forum 4

I'm using the Prototype framework to send a form via Ajax, and I'm using a form validation script ([url]http://tetlaw.id.au/view/javascript/...eld-validation[/url]) to validate the form. Both work beautifully by themselves. The problem is this: I need some way to merge the two so that the form submits after validation, and that the form is validated before it's submitted. Here's the validation code: [code] var dancingForm = new Validation('formDance', {useTitles:true}); [/code] And the submission code: [code] document.observe('dom:loaded', function() { function sendForm(event){ // we stop the default submit behaviour Event.stop(event); var oOptions = { method: "POST", parameters: Form.serialize("formDance"), asynchronous: true, onFailure: function (oXHR) { …

Member Avatar
Member Avatar
+0 forum 7

Hi all, I am creating a function, that filters products, that are allready loaded into the DOM. JSFiddle: http://jsfiddle.net/Klemme/8CFVa/2/ Please read on, two get the issue :-) In each product div, I have listet an HTML5 data attribut like this example: data-options="{"brand":"acer","screenSize":"17","processor":"intel","grafik":"intel"}" I have 2 groups of checkboxes working now, that makes it possible to show/hide products, based on the value of the checked checkbox, matched against the corresponding value in each products data-options attributte. It is not dynamic, and I have realized that whenever I want to add more sort options (more check boxes), I have to run through …

Member Avatar
+0 forum 0

Hello everyone! Needing some help with styling a DOM parse. I have been toying around with the style but continue to end up with whitespace parse errors... So first of all here is the working code Sorry about the paste however the code snippet continued to display: The code snippet in your post is formatted incorrectly. Please use the Code button in the editor toolbar when posting whitespace-sensitive text or curly braces. Even though I was using the code button. Currently the list parses in a direct row going down. I want it to display 4-5 elements on a line …

Member Avatar
Member Avatar
+0 forum 5

Hi all I've created simple javscript gallery using previous and next links. The problem is that I want fade effect between images like this: [url]http://tobia.github.com/CrossSlide/[/url] I've pasted few lines of jquery code in my javascript functions but the fade effects aren't the same. Any help will be greatly appreciated. Best regards. [CODE] <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> var NumberOfImages = 12 var img = new Array(NumberOfImages) img[0] = "images/1.jpg" img[1] = "images/2.jpg" img[2] = "images/3.jpg" img[3] = "images/4.jpg" img[4] = "images/5.jpg" img[5] = "images/6.jpg" img[6] = "images/7.jpg" img[7] = "images/8.jpg" img[8] = "images/9.jpg" img[9] = "images/10.jpg" img[10] = …

Member Avatar
Member Avatar
+0 forum 6

I would like to get Type, Id and Height values in database table. It is not working. There is no error message. Objective is to get RESPECTIVE "Type" from Catalaog which has same Reference from Installed. Well, I have 850 Mb XML file and i just would like to present small part of file: XML: <?xml version="1.0" encoding="utf-8"?> <Physical> <Catalog> <EquipmentSpec> <Reference>MAT_4</Reference> <Type>Duplexeur</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>0</CharacteristicValue></Characteristic> </EquipmentSpec> <EquipmentSpec> <Reference>MAT_6890</Reference> <Type>Node</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>2</CharacteristicValue></Characteristic> </EquipmentSpec> <EquipmentSpec> <Reference>MAT_50</Reference> <Type>Single</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>5</CharacteristicValue></Characteristic> </EquipmentSpec> </Catalog> <Installed> <Equipment> <Id>26</Id><Reference>MAT_4</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>160</CharacteristicValue></Characteristic> </Equipment> <Equipment> <Id>27</Id><Reference>MAT_6890</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>140</CharacteristicValue></Characteristic> </Equipment> <Equipment> <Id>28</Id><Reference>MAT_50</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>180</CharacteristicValue></Characteristic> </Equipment> </Installed> </Physical> Code: foreach ($xml->xpath('Physical') as $spec) { …

Member Avatar
Member Avatar
+0 forum 26

A short while ago I was intrigued by a reply made by nullptr in [this thread](http://www.daniweb.com/software-development/cpp/threads/458583/shellexecuteex-api). So I began to look for ways to access the rest of IE (IWebBrowser2) interface, and met limited and varied success. Accessing for instance a <div></div> element in a wep page html document was quite difficult as there is very little documentation and examples around the web, but I got there in the end. But I came upon a problem where I cannot seem to access an element in a frame on a webpage. I have marked in the code, what and where the …

Member Avatar
Member Avatar
+0 forum 5

I have written a script to get all elements then i go and find this element in another iframe. Wait, so essentially i have 2 frame's on a page, the one on the left i called the "online" and the 2nd one i called the "base". My end result is to compare the css with (getComputedStyle) with the element from 'online' compared to 'base'. I have the selecter built, from the body down, so like "body div.header div#logo img.home-log" but my problem is when it comes to li's or a links. So like "body ul.test li" but the DOM could …

Member Avatar
Member Avatar
+0 forum 1

Hi. I'm using JS for d3. What I intend to do is get some data from database and plot them in a diagram I've created. Here's what I've done so far: Fetched the data from database: <?php while($row = mysql_fetch_assoc($query)){ $q_id[] = $row['q_id']; $res_val[] = $row['response_value']; $chpt[] = $row['cr_chpt']; $lvl[] = $row['ql_level']; } ?> Sent it to JS: var id = <?php echo json_encode($q_id); ?>; var val = <?php echo json_encode($res_val); ?>; var chpt = <?php echo json_encode($chpt); ?>; var lvl = <?php echo json_encode($lvl); ?>; I'm having trouble creating an array for the data though. For static data I've …

Member Avatar
Member Avatar
+0 forum 12

Hi. I am looking at creating a small app which will gain access to and use the Internet Explorer DOM. I want to access the DOM of an existing instance of Internet Explorer. The app will be basic and simple, and will be first used to retieve properties of web page elements. My questions are, where do I start, what functions API's should I be looking at, bearing in mind that I intend to stay within the bounds of WIN32 (that is, if COM can be used within those bounds). My initial search was quite poor because of not knowing …

Member Avatar
Member Avatar
+0 forum 3

Hi. I use a fuction to retrieve some information from a remote site: $dom = new DOMDocument; @$dom->loadHTMLFile($url); $page_content = $dom->saveHTML(); When I echo the content, some characters appear like 'á'. I have tried many things from the internet, but nothing helped. Is there a solution?

Member Avatar
Member Avatar
+0 forum 2

I am using PHP Simple HTML DOM Parser * [Manual] to fetch data from websites. Now what i wanna do is to remove first three words from all span which has `class="yeah"` from the fetched content So i have implement this code but it has a problem: foreach($html->find('span.yeah') as $xdat) { $x_des = implode(' ', array_slice(explode(' ', strip_tags($xdat)), 0, 3)); $result = str_replace($x_des, ' ', $result); $result = str_get_html($result); } Though it delete first three words from all `<span class="yeah">` but the problem is, this modify full fetched content. But i wanna modify only those data whose are in `<span …

Member Avatar
Member Avatar
+0 forum 2

how to get content from a table id in [simple html dom parser](http://simplehtmldom.sourceforge.net), the table id is `products` and i have tried with this code: <?php include("dom.php"); $html = file_get_html("http://www.example.com"); $result = $html->find('table[id=products]'); echo "$result"; ?> but don't works, any idea to fetch content of a table which id is `products`? Thanks

Member Avatar
Member Avatar
+0 forum 1

I am just starting with Simple PHP HTML DOM PARSER so, what is the way to replace text only of any fetched content. Suppose i have fetched some content from a website with full HTML codes, but while applying PHP code like `$html = str_replace(".", "DOT", $html);` it cause a error. Because in this case it replace all `.` with `DOT` so that all links are broken, but what i want is just to replace `.` to `DOT` in texts but all code should be untouched. Assuming, The fetched data is something like this `<a href="http://example.com">Example.com</a>` The Output should be …

Member Avatar
Member Avatar
+0 forum 6

i wonder if it is possible to fetch images using [PHP Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/) and obtain it in a specific URL. Suppose it fetched a Image in a variable like $img = 'http://www.example.com/some_image_address.JPEG'; Now is it possible to get this image in my own domain path, like $new_img = 'http://mysite.com/some_image_address.JPEG'; I am a PHP beginner so please describe it

Member Avatar
Member Avatar
+0 forum 2

i have a script which will fetch content from a website, what i wanna do is modify all that links. Suppose: $html = str_get_html('<h2 class="r"><a class="l" href="http://www.example.com/2009/07/page.html" onmousedown="return curwt(this, 'http://www.example.com/2009/07/page.html')">SEO Result Boost <b> </b></a></h2>'); so, is it possible to modify or rewrite it in this way> <h2 class="r"><a class="l" href="http://www.site.com?http://www.example.com/2009/07/page.html">SEO Result Boost <b> </b></a></h2> I have read it's manual but can not understand how to figure it ( http://simplehtmldom.sourceforge.net/#fragment-12 ) Is It Possible, Any Idea?

Member Avatar
Member Avatar
+0 forum 5

My PHP script can fetch content from a div id, but what is the way to filter this fetch data and exclude some of its content which has this div id `<div id="navbar" class="n">content here content here</div>` I have tried with this code but its not working $regex = '#\<div id="navbar"\>(.+?)\<\/div\>#s'; preg_match($regex, $displaybody, $matches); $match = $matches[0]; echo "$match"; To fetch content i am using SIMPLE HTML DOM Parser( http://sourceforge.net/projects/simplehtmldom/files/ ), any idea?

Member Avatar
Member Avatar
+0 forum 11

For my code below i use getElementsByTagName('p') to get the values of the paragraphs that the user enters. but for some reason it when i use textNum[0].value it returns undefined. i tested it with textNum.length and the length keeps increasing which means values are being added to the array. not really sure what the problem is with it. Thanks for the help in advanced [CODE]<!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>Untitled Document</title> <style type="text/css"> #theform { font-family: "Courier New", Courier, monospace; font-size: 12px; } </style> <script type = "text/javascript"> function …

Member Avatar
Member Avatar
+0 forum 1

Somebody please help me. The page loads fine but when I change the option on select nothing happens. I'm sure it's just a small problem. Your help will go a long way. Thank you in advance. [CODE]<body> <table id="main" width="50%"> <tr> <td><div id="1"></div></td> <td><div id="2"></div></td> <td><div id="3"></div></td> <td><div id="4"></div></td> <td><div id="5"></div></td> <td ><div id="6"></div></td> <td><div id="7"></div></td> <td><div id="8"></div></td> <td><div id="9"></div></td> </tr> <tr> <td><div id="10"></div></td> <td><div id="11"></div></td> <td ><div id="12"></div></td> <td><div id="13"></div></td> <td><div id="14"></div></td> <td ><div id="15"></div></td> <td><div id="16"></div></td> <td><div id="17"></div></td> <td><div id="18"></div></td> </tr> <tr> <td ><div id="19"></div></td> <td ><div id="20"></div></td> <td ><div id="21"></div></td> <td ><div id="22"></div></td> <td ><div id="23"></div></td> <td …

Member Avatar
Member Avatar
+0 forum 3

hi I'm having serious problems with this code. It all started when I tried to use functions. The function easy() works fine when the page loads but the button has stopped calling the check() function. could it be because I have that stored inside another function? I tried placing outside the function easy() but it still didnt work. Does anyone have any ideas? You help will be greatly appreciated [CODE]window.onload = function(){ easy(); } function easy(){ var ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81] var items = [3,0,6,5,0,0,0,9,0,2,0,0,4,0,0,8,5,1,1,0,0,7,8,0,0,6,0,0,0,9,3,6,8,5,0,0,6,2,8,0,0,0,3,4,9,0,0,5,9,2,4,1,0,0,0,4,0,0,9,7,0,0,2,8,6, 3,0,0,1,0,0,5,0,7,0,0,0,3,4,0,8]; var ans = [3,8,6,5,1,2,7,9,4,2,9,7,4,3,6,8,5,1,1,5,4,7,8,9,2,6,3,4,1,9,3,6,8,5,2,7,6,2,8,1,7,5,3,4,9,7,3,5,9,2,4,1,8,6,5,4,1,8,9,7,6,3,2,8,6,3,2,4,1,9,7,5,9,7,2,6,5,3,4,1,8]; var x = 0 for (var i = 0; i …

Member Avatar
Member Avatar
+0 forum 4

The End.