Programming :: Javascript Line Break

Feb 25, 2011

I have some variables that are loaded from mysql - in mysql, the line breaks are not indicated by ' or '<br>' or anything -they are just line breaks. the variable is loaded into javascript and then inserted into a <pre> element. the line breaks are not showing up.

pre1 = pre1.replace(/>/g,">"); - this works well, naturally. but how do i get those line breaks to show up as line breaks in a browser?

I've tried many variations of something like:

View 1 Replies


ADVERTISEMENT

Programming :: Remove Line Break If Next Line Does Not Start With "PX"?

May 25, 2011

I have a big csv-file wich is not formatted very well. I clean it up with removing a lot of html etc, but some of the lines breaks where they are not supposed to.What I want to do is to check next line, if it starts with 'PX' I don't want to do anything, but if it does not start with 'PX' I want to merge the two lines. That is removing the newline character on line one and replace it with a space.Can this be done with sed? (or maybe with perl or something, but I'm more familiar with sed)I've been looking und the net to find a solution, but to no result.

View 8 Replies View Related

Software :: Command Line Browsing That Works With JavaScript Sites?

May 9, 2011

How can I verify JavaScript on a site (not on the same server) is working from command line access of the URL?

On checking some of what was written in 2005 I find most of it isn't still relevant (if it was then - I noted the w3m-js stuff mentioned in 2005 hadn't been updated since 2003).

Since then a couple of times I've looked into it but didn't make much headway but also didn't spend a lot of time on it. So far as I could tell from other posts I'd seen others hadn't either.

Recently I found out about Mozilla's SpiderMoneky js library and that it could be linked into elinks text browser and did same on my RHEL5 system.

I found Spidermonkey rpms in the EPEL (Fedora sponsored) repository:
js-1.70-8.el5.i386.rpm
js-1.70-8.el5.x86_64.rpm
js-devel-1.70-8.el5.i386.rpm
js-devel-1.70-8.el5.x86_64.rpm

I was able to download and install using rpm then compile elinks from source to include the above. Running elinks version after that shows the ECMAScript support is compiled into the new elinks binary. Also setting various ecmas* flags in the elinks.conf does have effect so clearly it is using them. (As opposed to another system where I use the original RHEL5 provided elinks RPM it complains about the ecmas* stuff being invalid options.)

It appears that by default it has this enabled but just for good measure I added:

set ecmascript.enable = 1.

Despite that when I pull up the page I see:

This product requires use of a browser that supports JavaScript

As a test I set the above to 0 on the off chance it was backwards and saw the same thing.

I then set the following:

set ecmascript.error_reporting = 1

On pulling up the page I now see a popup box:

Quote:

JavaScript Error:

A script embedded in the current document raised the

following exception:

TypeError: Window.Focus is not a function

OK

That seems to suggest that despite the earlier message about needing a browser that supports JavaScript that it is in fact executing at least one JS but that it is getting an error. Can anyone confirm that?

Does anyone have any idea what I�d need to do to deal with the Window.Focus message?

Essentially the site is a login page and even though I am able to input username and password after opening in browser when I tell it to POST it simply returns to the same login/password page.

And of course it doesn't have to be elinks/spidermonkey. I'd be interested in finding out if anyone knows a way I can verify a site that is running JavaScript is actually responding properly from command line rather than via a browser?

The SpiderMonkey stuff from Mozilla when compiled into elinks is supposed to do that but given my results Im not sure if it is or not.

Most of the documentation I can find on JavaScript stuff appears to be aimed at developers testing their own JS code from command line rather than accessing a web page with JavaScript.

View 8 Replies View Related

Programming :: How Break Points Work In GDB

Mar 24, 2011

I want to know that how the break points and watch points work in the GDB. I know the GDB works on symbol table. But would like to know more details of it. How watch points differ from break points.

View 3 Replies View Related

Programming :: Executive JavaScript Function Along With URL

Jun 15, 2011

There is this sample web page: [URL] and it has a clickable link / button that executes a JavaScript function: (Right-Click and Copy Shortcut would give this piece of code)

Code:
javascript:__doPostBack('lbtnUpdateStatus','')
whereas the source code for the link / button is as follows:
Code:
<a id="lbtnUpdateStatus" href="javascript:__doPostBack('lbtnUpdateStatus','')">

I want to automate the above function / link along with the said URL so that I won't have to open the webpage and click the button / link. I want a single URL hitting which we won't need to do the extra effort of "clicking the link / button" that executes the JavaScript function given above. I can't automate this task in the source webpage itself because that has to be there as it is for the users who access the webpage. How to achieve it?

I got some useful information here: [URL] but I want to call a javascript function along with a URL such as this:
Code:
[URL] javascript:alert("OKAY")
but the above line of code won't work.

View 9 Replies View Related

Programming :: Slideshow Of Images In Javascript?

Jun 28, 2011

Check out the frontpage of mail.com - how do I do the scrolling images in Javascript, like it's doing?

View 4 Replies View Related

Programming :: Javascript GUI Stuff On 123reg?

Jan 11, 2011

I went to [URL] the other day, and I'm really impressed with the way, when you click on domain, it adds it to the cart WITHOUT A REFRESH. But what I really want to know is - how does it do the slick little effect when you click "Add to basket", when it "appears" on the right hand side?

View 4 Replies View Related

Programming :: Javascript To Verify Correct URL?

May 31, 2011

Lets say I have a site "Website1.com"

On that site I want to run a little javascript that verifies that the site was accessed as "Website1.com" and not "dev-Website1.com"

If it was accessed correctly, nothing happens. If it was accessed incorrectly, it displays an error saying "You are trying to access this site incorrectly."

What is the simplest way to accomplish this?

View 1 Replies View Related

Programming :: JavaScript - Window.onbeforeunload

Nov 13, 2010

I am using window.onbeforeunload to keep people from accidentally leaving. I was hoping to intercept this event, run my own dialog box and load another page that closes the window, or of course, cancel.

I'm needing this because my site is a single page and I can't figure out how long people are visiting for, if I could load an exit page, then I can figure this out.

View 6 Replies View Related

Programming :: Understanding This Construct In Javascript?

Dec 3, 2010

var param = function() { <whatever> } ;What exactly does the above MEAN, and why have they included this in the language this way?

View 6 Replies View Related

Programming :: Trying To Understand This Function In JavaScript

Dec 9, 2010

In my book, this is an example of a recursive algorithm:

var reverseArray = function(x,indx,str) {
return indx == 0 ? str : reverseArray(x,--indx,(str+= " " + x[indx])) ;; }
var arr = new Array('apple','orange','peach','lime');
var str = reverseArray(arr,arr.length,"");
alert(str) ;

I'm trying to understand it, I'm stuck at the (str+= " " + x[indx])) part - that part of the function definition expects an ARGUMENT, am I right? What's being passed to it is a bit of PROGRAM, the str+= stuff. So - how is it working?

View 7 Replies View Related

Programming :: An Array With 15 Elements, And Want To Break It Down Into Three Columns?

Jul 20, 2011

I have an array with 15 elements, and I want to break it down into three columns. When the array is split into a the three elements - however on the iteration, it does not conform to that structure.

Code:
#!/usr/bin/perl -w
use strict ;

[code]....

View 13 Replies View Related

Programming :: Audio Level Meter In Javascript

May 23, 2011

When someone is speaking into the mic, I'd like a "level meter" such as the one that comes with gnome sound recorder, that flashes up and down when a sound is made or somebody talks.This will be done in Javascript, using the brand new "Rainbow API", i.e. inside the browser.I know nothing about audio programming, so - where would I get *started* with something like this? Could anyone tell me at least WHAT to Google?

View 3 Replies View Related

Programming :: JavaScript - File Not Recognized As XML By Firefox

Feb 4, 2010

I'm loading an XML file stored in a tiny web server (based on lwip). This web server is not very cooperative and is not marking the http content-type as "text/xml". As result, Firefox is not recognizing the file as xml (IE does) so I can't use DOM methods for parsing the xml file. overrideMimeType("text/xml") should help me avoid this problem but, even having overrided the mymetype, the content-type received is still "text/plain". This is a portion of my JavaScript code:

Code:
var xmlObj;
// loadXMLdata is called from the html file
function loadXMLdata() {
var dataFile = window.location.href.substring(0, window.location.href.lastIndexOf("/") + 1) + "config/myfile.xml";
if (window.XMLHttpRequest) {
xmlObj = new XMLHttpRequest();

// This should override the mimetype...
if (xmlObj.overrideMimeType)
xmlObj.overrideMimeType("text/xml");
xmlObj.onreadystatechange = fillXMLdata;
xmlObj.open("GET", dataFile, true);
xmlObj.send("");
} else {
alert("Your browser can not handle this script");
return; } }
// fillXMLdata is called from loadXMLdata once the xml object is ready
function fillXMLdata() {
if (xmlObj.readyState == 4) {
// Here Content-Type shows again "text/plain"
alert(xmlObj.getAllResponseHeaders());
var xmlDoc = xmlObj.responseXML.documentElement;
// And here section is null
var section = xmlDoc.getElementsByTagName("section")[0]; } }
The xml is quite simple:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<section>
<item>1</item>
<item>2</item>
</section>

View 1 Replies View Related

Programming :: Javascript Image Sliding Direction?

Jun 2, 2010

im trying to learn javascript. so i choose to start out making a image slideshow banner that auto scrolls on load no special buttons. so since i had no idea were to start i found code that was free to use commercial and non commercial and ill be able to change it. heres that code:

Code:
var SLIDETIMER = 3;
var SLIDESPEED = 3;

[code]....

View 2 Replies View Related

Programming :: Javascript Many Characters As Reg Expression Replace?

Jan 2, 2010

I'm working with javascript and trying to replace all instances of a Roman character in a string with nothing. How do I assign var reg to all Roman characters? In UTF8, capital letter A is U0041 and at the other end, small z is UFF5A.

So, I'd like to do something like:
var reg = u0041 - UFF5A;
str1 = str.replace(reg, '');

I think you get the idea. I have no idea if that can be done. The idea is to take this string (for example): str = make a door-to-door[house-to-house] visit / ring every doorbell." And take out all the Roman characters and define it as str1. And then take out all the Korean characters (u1100-uFFDC) and define it as str2. In fact, a WAY more useful thing to do would be to replace the instance of this: [u1100-uFFDC]+" "+[u0041-UFF5A] with [u1100-uFFDC]+","+[u0041-UFF5A] so that the output would be a .csv file.

View 5 Replies View Related

Programming :: Playing Sound In Javascript And HTML5?

Jan 14, 2011

I can play a sound on my local machine using the following code, but when I upload to a server the same code it does not play. I cannot work out why, the link below gives the code. The multi channel code is here:

[URL]

Code:
<audio id="multiaudio1" src="audio/flute_c_long_01.wav" preload="auto"></audio>
<audio id="multiaudio2" src="audio/piano_chord.wav" preload="auto"></audio>
<audio id="multiaudio3" src="audio/synth_vox.wav" preload="auto"></audio>
<audio id="multiaudio4" src="audio/shimmer.wav" preload="auto"></audio>

[Code].....

View 4 Replies View Related

Programming :: The Perfect Javascript Tutorial Or Book?

Jul 30, 2011

I'm looking for javascript tutorials or books that meets the following criteria:

1. Very thorough: Starts with the most fundamental concepts and progresses logically from basic to advanced concepts, without skipping over important ideas for the sake of expediency.

2. Lots of small practice exercises that parallel the concepts and syntax being learned.

I've looked at a lot of tutorials, but they all tend to be lacking in one of these areas or the other.

View 1 Replies View Related

Programming :: How To Validate An IPv6 Address Through Javascript

Jun 18, 2010

How can I validate an IPv6 address through javascript before using the IPv6 value in my cgi script?

View 2 Replies View Related

Programming :: Split / Break Up Large Text File

Feb 18, 2011

I have a large text file with three columns. I'm trying to write a PERL script that splits the file up based on the value of the 3rd column. So every time the third column reads 0, a new file is created and all the data up until the next 0 is found is written to that new file. This should happen over and over until the initial file has been entirely split up.

ex data:
000
2024
2243
2143
96962871
97972878
000
2034
3034
3352

So with the data above, the file would be split into two files:
data_1.txt would contain
000
2024
2243
2143
96962871
97972878

and data_2.txt would contain
230
2034
3034
3352

View 10 Replies View Related

Programming :: Script To Break A Block Of Text On To Different Lines?

Dec 15, 2010

I have a clump of text that needs to be broke up:gdbm Sat 07 Feb 2009 03:28:18 AM EST libattr Sat 07 Feb 2009 03:28:18 AM EST db4 Sat 07 Feb 2009 03:28:19 AM EST mktemp Sat 07 Feb 2009 03:28:19 AM EST keyutils Sat 07 Feb 2009 03:28:20 AM EST pcre Sat 07 Feb 2009 03:28:21 AM EST setserial Sat 07 Feb 2009 03:28:24 AM EST zlib Sat 07 Feb 2009 03:28:24 AM EST gawk Sat 07 Feb 2009 03:28:25 AM EST readline Sat 07 Feb 2009 03:28:26 AM EST rhpl Sat 07 Feb 2009 03:28:28 AM EST cracklib-dicts Sat 07 Feb 2009 03:28:37 AM EST setools Sat 07 Feb 2009 03:28:37 AM EST hal Sat 07 Feb 2009 03:28:38 AM EST which Sat 07 Feb 2009 03:28:39 AM EST Is there a way to get everything after the EDT in the text to be moved to a new line?

View 13 Replies View Related

Programming :: [HTML/CSS/Javascript] Moving Background Image?

Jun 10, 2011

I am trying to set up a webpager that contains a background of the skylouds uperimposedin the center will be an image of an airplane with a transparent background.I want the sky to scroll continuously to the left behind the airplane. I am having problems with the background not being visible, not moving as expected, the airplane not being visible, and just disappointment in general.I think the background of a div will not be visible if there are no internal contents because it will be sized to zero. So I introduced another transparent image to force the size of the main div. Still no joy.Here is my code. Note that I don't have my timers set up yet, just a button to test background movement.

Code:
<!DOCTYPE html>
<html>

[code]...

View 2 Replies View Related

Programming :: Access HTML Elements Via Javascript With Internal ID?

Mar 29, 2010

Is there some way to access HTML elements via javascript through some internal ID?

For instance, given a form like:

Code:
<form name="myForm">
<input type="text" />
<input type="text" />

[Code]....

I think I've seen some way to do this before but I'm not certain

View 4 Replies View Related

Programming :: Have The Javascript Include On The Page (it's A Php Template So That's Elsewhere In The Code?

Jun 6, 2011

this should have been a simple task, but for some reason one of my rollovers plain old isn't workingmy html sheet

Code:
<div style="background:#F5F5E9 url('/sites/all/themes/flossmoore1/images/bricks250.png');padding:1px;padding-

[code]....

View 1 Replies View Related

Programming :: Mechanize Alternatives That Can Detect Javascript Pop-up Windows?

Nov 25, 2010

I am working on scraping a sit e but during the authentication process (a form and user/password then submit) a javascript pop-up window comes up that needs to be pressed.I was planning on using www:mechanize but found out it doesnt do javascript.

View 2 Replies View Related

Programming :: Copy And Replacing Specific Line From File1 To File2 Line By Line

Mar 22, 2011

I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.

At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.

What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.

I tried to use paste command but I cant do for specified line alone.

Here i showed the data format in the file. I used the line number for clarity purpose.

Code:

View 10 Replies View Related

Programming :: Regular Expression Working Fine In JavaScript But Not In Python?

Jun 22, 2010

I have this regular expression

Code:

(@description ").*(";)

I want to match anything in between the quotes its working fine in JavaScript but its not working in my python program:

Code:

#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import re

[code]....

View 3 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Software :: Finding Textbrowser With JavaScript Support Or Elink Javascript Support?

Sep 1, 2009

I need a textbrowser with Javascript Support. I have compiled the elinks stable 0.11x and the unstable 0.12x version mit JavaScript Support (js moz dev). Both browsers can be started and showed websites normaly. But no javascript, even simple tests like [URL] failed. I started elink with ./elink and typed then the url.

View 4 Replies View Related

Programming :: Compare Two Files Line By Line And Print The Line Which Is Same?

May 30, 2011

I am trying to write a program in C which compares two files and prints the line that is equal.

Here file1.txt has

and file2.txt has

Note: file2.txt consist of only a single string where as file2.txt has multiple lines. Actually im comparing two files with md5sum values.

Here is the code but it compares only first line of files..but it should compare the whole file1..and sorry iam a beginner in C can any1 sujest some modification to this code so that..it can compare file2 with entire file1

Quote:

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved